如何从MongoDB 1.8升级到2.4时,通过MongoDB / PCRE“符号查找错误” [英] How to get past MongoDB/PCRE “symbol lookup error” when upgrading from MongoDB 1.8 to 2.4
问题描述
我在继承的服务器上做一些Ruby开发(aka:我从来没有初始设置),但是一段时间没有维护,注意到当2.4系列升级时安装的MongoDB版本是1.8可用。由于该框运行的是使用 yum
安装RPM的RedHat / CentOS变体,我继续做我通常做的升级。首先,停止正在运行的MongoDB实例,如下所示:
sudo服务mongod stop
/ pre>
然后从仓库升级软件包。
sudo yum install mongodb mongodb-server libmongodb
一切顺利,包括正在安装的依赖项。但是当我去重新启动MongoDB bia这个命令:
sudo服务mongod start
没有发生任何事情。连接死了。检查MongoDB日志显示以下一个可悲的错误行:
/ usr / bin / mongod:符号查找错误:/ usr / mongod:undefined symbol:_ZN7pcrecpp2RE4InitEPKcPKNS_10RE_OptionsE
这是什么原因?我看到了此问题和回答线,推荐重建从RPM源以及其他帖子在线,建议一些变种:下载源代码重新编译或直接从MongoDB网站下载RPM。但所有这些解决方案似乎激进的应该是一个简单的包安装程序更新?可能发生什么?
解决方案我想出来了。有点意外,但相当肯定这是解决方案。简短的答案?如果你得到
/ usr / bin / mongod:符号查找错误:/ usr / bin / mongod:undefined symbol:_ZN7pcrecpp2RE4InitEPKcPKNS_10RE_OptionsE
,那么你应该安装pcre
c $ c> sudo yum install pcre pcre-devel
正在辞职,以重新编译从头开始,如本答案中所述。这是我不想做的,除非有一个很好的理由。但是正如回答者所说,在重新编译之前,应该安装以下编译器项目和相关库:
sudo yum install rpm-build redhat -rpm-config gcc gcc-c ++ make yum install openssl-devel snappy-devel v8-devel boost-devel python-devel python-nose scons pcre-devel readline-devel libpcap-devel gperftools-devel
好吧,所以我做了一个源代码重建的基础。但也注意到在安装,
pcre
正在安装,因为它显然缺少和必需的依赖关系pcre-devel
;这是关键。当我准备重新编译时,我只是决定尝试重新开始mongod
:sudo service mongod start
Lo和看,MongoDB安装再次运行!但为什么? 此回答在这里拥有线索:
错误是由
libpcre
更改
RE :: Init()
的签名造成的只需要一个std :: string
,而不是char *
。如果你得到一个较新版本的libpcrecpp
,这个
是固定的,它为后向兼容添加了
old接口。
这个答案也建议从源码重新编译,但现在没有什么意义,因为很明显我的MongoDB安装已经启动并再次运行。所以我在开发盒上运行
lsof
,看到了这样:sudo lsof | grep pcre
nginx 892 deploy mem REG 253,2 97140006(已删除)/lib64/libpcre.so.0.0.1(stat:没有这样的文件或目录)
nginx 893 deploy mem REG 253,2 97140006 (删除)/lib64/libpcre.so.0.0.1(stat:没有这样的文件或目录)
nginx 1369 root mem REG 253,2 97140006(deleted)/lib64/libpcre.so.0.0.1(stat :没有这样的文件或目录)
mongod 26841 mongodb mem REG 253,2 1052673 /usr/lib64/libpcrecpp.so.0.0.0(path dev = 0,53)
mongod 26841 mongodb mem REG 253 ,2 97126735 /lib64/libpcre.so.0.0.1(path dev = 0,53)
grep 28590 deploy mem REG 253,2 97126735 /lib64/libpcre.so.0.0.1(path dev = 0, 53)
注意
mongod
加载/lib64/libpcre.so.0.0.1
。这是必须的,对吗?
我通过跳转到这个设置的合作伙伴/双生产盒确认了 - 我没有升级MongoDB,
lsof
命令,这是结果:sudo lsof | grep pcre
nginx 922 root mem REG 253,2 81795343(已删除)/lib64/libpcre.so.0.0.1(stat:没有这样的文件或目录)
nginx 923 deploy mem REG 253,2 81795343 (删除)/lib64/libpcre.so.0.0.1(stat:没有这样的文件或目录)
nginx 924 deploy mem REG 253,2 81795343(deleted)/lib64/libpcre.so.0.0.1(stat :没有这样的文件或目录)
grep 8067 deploy mem REG 253,2 81791051 /lib64/libpcre.so.0.0.1(path dev = 0,61)
注意如何比较100%没有
mongod的实例
loadinglib64 / libpcre.so.0.0.1
。所以这个问题的解决方案不是从源代码重新编译,因此处理一个非RPM安装的头痛,而只是从存储库中安装pcre
。 / p>I’m doing some Ruby development on servers that I have inherited (aka: I never originally set up.) that haven’t been maintained in a while and noticed that the installed MongoDB version was 1.8 when a 2.4 series upgrade was available. Since the box is running a RedHat/CentOS variant that uses
yum
to install RPMs, I went ahead and do what I usually do to upgrade. First, stop the running MongoDB instance like this:sudo service mongod stop
And then upgrade the packages from the repo.
sudo yum install mongodb mongodb-server libmongodb
All went well including dependencies being installed as well. But when I went to restart MongoDB bia this command:
sudo service mongod start
Nothing appeared to happen. Connections were dead. Checking the MongoDB log showed the following one sad error line:
/usr/bin/mongod: symbol lookup error: /usr/bin/mongod: undefined symbol: _ZN7pcrecpp2RE4InitEPKcPKNS_10RE_OptionsE
What the heck is that about? I saw this question and answer thread that recommending rebuilding from the RPM source as well as other posts online that advise some variant of the same: Download source code to recompile or download the RPM directly from the MongoDB site. But all of those solutions seem to radical for what should be a simple package installer update? What could be happening?
解决方案I figured it out. Somewhat accidentally, but fairly certain this is the solution. The short answer? If you get that
/usr/bin/mongod: symbol lookup error: /usr/bin/mongod: undefined symbol: _ZN7pcrecpp2RE4InitEPKcPKNS_10RE_OptionsE
then you should installpcre
andpcre-devel
from the repository like this:sudo yum install pcre pcre-devel
Details on how I discovered this are basically, I was resigning myself to recompiling from scratch as outlined in this answer. That is something I do not want to do unless there is a very good reason. But as the answerer states, before recompiling one should install the following compiler items and related libraries:
sudo yum install rpm-build redhat-rpm-config gcc gcc-c++ make yum install openssl-devel snappy-devel v8-devel boost-devel python-devel python-nose scons pcre-devel readline-devel libpcap-devel gperftools-devel
Okay, so I did that to lay down the groundwork for a source code rebuild. But also noticed in the install that
pcre
was being installed as it was apparently missing and required dependency forpcre-devel
; this is key. As I was getting ready to recompile I just decided to attempt to startmongod
again like this:sudo service mongod start
And checked. Lo and behold, the MongoDB install was running again! But why? This answer here holds the clue:
The error was caused by
libpcre
changing the signature ofRE::Init()
to only take astd::string
, rather than achar*
. This is fixed if you get a newer version oflibpcrecpp
, which adds the old interface for backwards compat.That answer also recommended recompiling from source, but now that made little sense since it was clear my MongoDB install was up and running again. So I ran
lsof
on the development box and saw this:sudo lsof | grep pcre nginx 892 deploy mem REG 253,2 97140006 (deleted)/lib64/libpcre.so.0.0.1 (stat: No such file or directory) nginx 893 deploy mem REG 253,2 97140006 (deleted)/lib64/libpcre.so.0.0.1 (stat: No such file or directory) nginx 1369 root mem REG 253,2 97140006 (deleted)/lib64/libpcre.so.0.0.1 (stat: No such file or directory) mongod 26841 mongodb mem REG 253,2 1052673 /usr/lib64/libpcrecpp.so.0.0.0 (path dev=0,53) mongod 26841 mongodb mem REG 253,2 97126735 /lib64/libpcre.so.0.0.1 (path dev=0,53) grep 28590 deploy mem REG 253,2 97126735 /lib64/libpcre.so.0.0.1 (path dev=0,53)
Note how the
mongod
user is loading/lib64/libpcre.so.0.0.1
. That has to be it, right?I confirmed this by jumping onto the partner/twin production box of this setup—where I did not upgrade MongoDB on yet—and ran the same
lsof
command and this was the result:sudo lsof | grep pcre nginx 922 root mem REG 253,2 81795343 (deleted)/lib64/libpcre.so.0.0.1 (stat: No such file or directory) nginx 923 deploy mem REG 253,2 81795343 (deleted)/lib64/libpcre.so.0.0.1 (stat: No such file or directory) nginx 924 deploy mem REG 253,2 81795343 (deleted)/lib64/libpcre.so.0.0.1 (stat: No such file or directory) grep 8067 deploy mem REG 253,2 81791051 /lib64/libpcre.so.0.0.1 (path dev=0,61)
Note how in comparison there is 100% no instance of
mongod
loading/lib64/libpcre.so.0.0.1
. So the solution to this issue was not to recompile from source—and thus dealing with the headaches of a no-RPM install—but rather just to installpcre
from the repository.这篇关于如何从MongoDB 1.8升级到2.4时,通过MongoDB / PCRE“符号查找错误”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!