error:while loading shared libraries: libevent-2.1.so.6: cannot open shared object file: No such file or directory
执行 memcached 启动命令时,报错,提示:error while loading shared libraries: libevent-2.1.so.6: cannot open shared object file: No such file or directory
查看 memcached 命令缺失什么库
ldd /usr/local/bin/memcached
查看 libevent-1.2.so.1 是否存在 locate libevent-1.2.so.1
结果: 系统已经安装了该模块,在路径 /usr/local/lib/
查看 memcached 查找依赖库的路径
LD_DEBUG=libs /usr/local/memcached/bin/memcached -v
结果: 在 /lib64/ 目录中查找,所以找不到已经安装好的
映射 libevent-1.2.so.1 到 /lib64 路径中 ln -s /usr/local/lib/libevent-1.2.so.1 /usr/lib64/libevent-1.2.so.1
结果:这样处理后,memcached就可以搜索到该文件了
启动memcached /usr/local/bin/memcached -d -c 10240 -m 1024 -u root