memcache基本操作(包括错误问题)
一、出现问题
[root@jago-dbtest memcached-1.4.17]# /usr/local/bin/memcached -d -m 10 -u root -p 11211 -c 32 -P /tmp/memcached.pid
/usr/local/bin/memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory
二、解决办法
2.1、查找文件实际位置
[root@jago-dbtest memcached-1.4.17]# find / -name libevent-1.4.so.2
/home/libevent-1.4.14b-stable/.libs/libevent-1.4.so.2
/usr/local/lib/libevent-1.4.so.2
2.2、打印debug信息
[root@jago-dbtest memcached-1.4.17]# LD_DEBUG=libs /usr/local/bin/memcached -v
24264: find library=libevent-1.4.so.2 [0]; searching
24264: search cache=/etc/ld.so.cache
24264: search path=/lib64/tls/x86_64:/lib64/tls:/lib64/x86_64:/lib64:/usr/lib64/tls/x86_64:/usr/lib64/tls:/usr/lib64/x86_64:/usr/lib64 (system search path)
24264: trying file=/lib64/tls/x86_64/libevent-1.4.so.2
24264: trying file=/lib64/tls/libevent-1.4.so.2
24264: trying file=/lib64/x86_64/libevent-1.4.so.2
24264: trying file=/lib64/libevent-1.4.so.2
24264: trying file=/usr/lib64/tls/x86_64/libevent-1.4.so.2
24264: trying file=/usr/lib64/tls/libevent-1.4.so.2
24264: trying file=/usr/lib64/x86_64/libevent-1.4.so.2
24264: trying file=/usr/lib64/libevent-1.4.so.2
24264:
/usr/local/bin/memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory
2.3、软连接或者拷贝文件到所在目录
[root@jago-dbtest memcached-1.4.17]# ln -s /usr/local/lib/libevent-1.4.so.2 /usr/lib64/libevent-1.4.so.2
三、启动
[root@jago-dbtest memcached-1.4.17]# /usr/local/bin/memcached -d -m 10 -u root -p 11211 -c 32 -P /tmp/memcached.pid
四、检验memcached是否启动
[root@jago-dbtest memcached-1.4.17]# ps -ef|grep memcached | grep -v grep
root 24267 1 0 21:40 ? 00:00:00 /usr/local/bin/memcached -d -m 10 -u root -p 11211 -c 32 -P /tmp/memcached.pid
[root@jago-dbtest memcached-1.4.17]#
五、杀掉memcached
[root@jago-dbtest memcached-1.4.17]# kill `cat /tmp/memcached.pid`
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。