memcached 启动报error while loading shared libraries: libevent-***: cannot open shared obje
笔者今天在一台服务器(CentOS 5.4 64bit)上安装memcache.
在启动memcached的时候发现如下错误:
/usr/bin/memcached: error while loading shared libraries:libevent-1.4.so.2: cannot open shared object file: No such file ordirectory
如提示所示,是因为找不到 libevent-1.4.so.2 这个类库.
我们用
LD_DEBUG=libs /usr/bin/memcached -v2>&1 > /dev/null |less
方式来进行查找 memcached 从哪些地方查找此类库.
# LD_DEBUG=libs /usr/local/memcached/bin/memcached -v2>&1 > /dev/null |less
1
2
3
4
5
6
7
8
9
10
11
12
|
25400:
25400:
25400:
25400:
25400:
25400:
25400:
25400:
25400:
25400:
25400:
|
发现在/usr/local/libevent/lib/下有libevent-1.4.so.2
于是添加一个软链
ln -s /usr/local/libevent/lib/libevent-1.4.so.2/usr/lib64/libevent-1.4.so.2
此时我们再执行
# /usr/bin/memcached -d -m2048 -uroot -p11212 -P/tmp/memcache.pid
发现memcached可以正常启动