libevent-1.4.so.2: cannot open shared object file
[root@ecs init.d]# systemctl status memcached.service
● memcached.service - SYSV: The memcached daemon is a network memory cache service.
Loaded: loaded (/etc/rc.d/init.d/memcached; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2022-11-28 12:04:29 CST; 2s ago
Docs: man:systemd-sysv-generator(8)
Process: 27667 ExecStart=/etc/rc.d/init.d/memcached start (code=exited, status=1/FAILURE)
Nov 28 12:04:29 ecs.novalocal systemd[1]: Starting SYSV: The memcached daemon is a network memory cache service....
Nov 28 12:04:29 ecs.novalocal memcached[27667]: Starting memcached: [FAILED]
Nov 28 12:04:29 ecs.novalocal systemd[1]: memcached.service: control process exited, code=exited status=1
Nov 28 12:04:29 ecs.novalocal systemd[1]: Failed to start SYSV: The memcached daemon is a network memory cache service..
Nov 28 12:04:29 ecs.novalocal systemd[1]: Unit memcached.service entered failed state.
Nov 28 12:04:29 ecs.novalocal systemd[1]: memcached.service failed.
[root@ecs init.d]#
[root@ecs bin]# ./memcached start
./memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory
[root@ecs bin]#
[root@ecs bin]#
[root@ecs bin]# ls /usr/local/lib/libevent-1.4.so.2
ls: cannot access /usr/local/lib/libevent-1.4.so.2: No such file or directory
[root@ecs bin]# yum install -y libevent
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Package libevent-2.0.21-4.el7.x86_64 already installed and latest version
Nothing to do
[root@ecs bin]# ll /usr/local/lib/libevent-1.4.so.2
ls: cannot access /usr/local/lib/libevent-1.4.so.2: No such file or directory
[root@ecs bin]#
[root@ecs bin]#
[root@ecs bin]# ll /usr/lib64/libevent-1.4.so.2
ls: cannot access /usr/lib64/libevent-1.4.so.2: No such file or directory
[root@ecs bin]#
[root@ecs bin]#
[root@ecs bin]# ll /usr/lib64/libevent
libevent-2.0.so.5 libevent_core-2.0.so.5.1.9 libevent_openssl-2.0.so.5 libevent_pthreads-2.0.so.5.1.9
libevent-2.0.so.5.1.9 libevent_extra-2.0.so.5 libevent_openssl-2.0.so.5.1.9
libevent_core-2.0.so.5 libevent_extra-2.0.so.5.1.9 libevent_pthreads-2.0.so.5
[root@ecs bin]#
[root@ecs bin]#
[root@ecs bin]# find / -name libevent-1.4.so.2
[root@ecs bin]# LD_DEBUG=libs /usr/local/bin/memcached -v
-bash: /usr/local/bin/memcached: No such file or directory
[root@ecs bin]#
[root@ecs bin]#
[root@ecs bin]# ll
total 336
-rwxr-xr-x 1 root root 339730 Apr 3 2018 memcached
-rw-r--r-- 1 root root 5 Sep 5 2020 memcached.pid
[root@ecs bin]# ./memcached -v
./memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory
[root@ecs bin]# cd /usr/local/lib/
[root@ecs lib]# rz -E
rz waiting to receive.
[root@ecs lib]#
[root@ecs lib]# ll
total 108
-rw-r--r-- 1 root root 106656 Jun 22 2012 libevent-1.4.so.2
[root@ecs lib]# cd /iflytek/sgy/server/memcached/
[root@ecs memcached]#
[root@ecs memcached]# cd bin/
[root@ecs bin]# ./memcached -v
./memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory
[root@ecs bin]#
[root@ecs bin]# ln -s /usr/local/lib/libevent-1.4.so.2 /usr/lib64/libevent-1.4.so.2
[root@ecs bin]#
[root@ecs bin]#
[root@ecs bin]#
[root@ecs bin]# service memcached start
Starting memcached (via systemctl): [ OK ]
[root@ecs bin]#
[root@ecs bin]#
[root@ecs bin]#
[root@ecs bin]# ps -ef | grep mem
root 28937 1 0 12:20 ? 00:00:00 /iflytek/sgy/server/memcached/bin/memcached -d -p 11211 -u root -m 5120 -c 1024 -P /iflytek/sgy/server/memcached/bin/memcached.pid -vv
root 28952 15841 0 12:20 pts/0 00:00:00 grep --color=auto mem
[root@ecs bin]# netstat -apn | grep 11211
tcp 0 0 0.0.0.0:11211 0.0.0.0:* LISTEN 28937/memcached
tcp6 0 0 :::11211 :::* LISTEN 28937/memcached
udp 0 0 0.0.0.0:11211 0.0.0.0:* 28937/memcached
udp6 0 0 :::11211 :::* 28937/memcached
[root@ecs bin]#
查找libevent-1.4.so.2文件:find / -name libevent-1.4.so.2
建立软链:ln -s /usr/local/lib/libevent-1.4.so.2 /usr/lib64/libevent-1.4.so.2
再次启动memcached服务:service memcached start 服务正常