error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such fil

启动memcached报错

/usr/local/memcached/bin/memcached -u root -p 11211 -m 2048m -d 

/usr/local/memcached/bin/memcached: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory

排查方法

[root@cmjs-live02-6312 memcached-1.4.5]# ldd /usr/local/memcached/bin/memcached 
linux-vdso.so.1 =>  (0x00007fff6c7ff000)
libevent-2.0.so.5 => not found
libpthread.so.0 => /lib64/libpthread.so.0 (0x00000036d6400000)
libc.so.6 => /lib64/libc.so.6 (0x00000036d6000000)
/lib64/ld-linux-x86-64.so.2 (0x00000036d5800000)

注: ldd能够显示可执行模块的dependency,其原理是通过设置一系列的环境变量,可以定位报错库文件

[root@cmjs-live02-6312 memcached-1.4.5]# whereis libevent-2.0.so.5  ##查找现有库文件libevent-2.0.so.5的路径
libevent-2.0.so: /usr/lib/libevent-2.0.so.5 /usr/local/lib/libevent-2.0.so.5   


[root@cmjs-live02-6312 memcached-1.4.5]#  LD_DEBUG=libs ./memcached -v   ##跟踪运行memcached所有加载库文件的路径
     13464: find library=libevent-2.0.so.5 [0]; searching
     13464: search cache=/etc/ld.so.cache
     13464: 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)
     13464:  trying file=/lib64/tls/x86_64/libevent-2.0.so.5
     13464:  trying file=/lib64/tls/libevent-2.0.so.5
     13464:  trying file=/lib64/x86_64/libevent-2.0.so.5
     13464:  trying file=/lib64/libevent-2.0.so.5
     13464:  trying file=/usr/lib64/tls/x86_64/libevent-2.0.so.5
     13464:  trying file=/usr/lib64/tls/libevent-2.0.so.5
     13464:  trying file=/usr/lib64/x86_64/libevent-2.0.so.5
     13464:  trying file=/usr/lib64/libevent-2.0.so.5
     13464:
./memcached: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory

在查找以上所有路径未果后报错,解决方法只要将上述路径的一个做个软连接即可

[root@cmjs-live02-6312 memcached-1.4.5]# ln -s /usr/lib/libevent-2.0.so.5 /lib64/libevent-2.0.so.5  

[root@cmjs-live02-6312 memcached-1.4.5]# ldd /usr/local/memcached/bin/memcached ##验证库文件是否找到
linux-vdso.so.1 =>  (0x00007fffda5ff000)
libevent-2.0.so.5 => /lib64/libevent-2.0.so.5 (0x00007f9699a93000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00000036d6400000)
libc.so.6 => /lib64/libc.so.6 (0x00000036d6000000)
librt.so.1 => /lib64/librt.so.1 (0x00000036d6800000)
/lib64/ld-linux-x86-64.so.2 (0x00000036d5800000)

[root@cmjs-live02-6312 memcached-1.4.5]# /usr/local/memcached/bin/memcached -u root -p 11211 -m 2048m -d 
[root@cmjs-live02-6312 memcached-1.4.5]# ps -ef |grep memcache 
root     14814     1  0 16:28 ?        00:00:00 /usr/local/memcached/bin/memcached -u root -p 11211 -m 2048m -d


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值