我刚刚安装了 CentOS 7,带有 Apache 2、PHP 5.6。我还安装了 memcached,但它在使用几个小时后不断出现故障,所以我每天必须重启它至少 3 次。
[root@myserver log]# systemctl status memcached
● memcached.service - Memcached
Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled; vendor preset: disabled)
Active: failed (Result: signal) since Sun 2017-07-30 22:23:06 -05; 2h 25min ago
Process: 26572 ExecStart=/usr/bin/memcached -u $USER -p $PORT -m $CACHESIZE -c $MAXCONN $OPTIONS (code=killed, signal=KILL)
Main PID: 26572 (code=killed, signal=KILL)
Jul 30 22:23:06 myserver memcached[26572]: <146 get 404c6f93ca60c76ebb7726a13...f
Jul 30 22:23:06 myserver memcached[26572]: >146 END
Jul 30 22:23:06 myserver memcached[26572]: <51 connection closed.
Jul 30 22:23:06 myserver memcached[26572]: <74 get a7f18fd516cd715c85e2c1e049...9
Jul 30 22:23:06 myserver memcached[26572]: >74 sending key a7f18fd516cd715c85...9
Jul 30 22:23:06 myserver memcached[26572]: >74 END
Jul 30 22:23:06 myserver memcached[26572]: <111 get 85f6b002ccbc678d0d0039d04...9
Jul 30 22:23:06 myserver memcached[26572]: >111 END
Jul 30 22:23:06 myserver systemd[1]: Unit memcached.service entered failed state.
Jul 30 22:23:06 myserver systemd[1]: memcached.service failed.
这是/etc/sysconfig/memcached(它没有在定义的文件中记录任何内容):
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-vv >> /var/log/memcached.log 2>&1"
主要问题是如何避免服务不断失败。有什么想法吗?谢谢。
答案1
“journalctl -u memcached” 会返回某些内容吗?看起来它的进程被终止了,而不是自己崩溃了 {Main PID: 26572 (code=killed, signal=KILL)} 你在 /var/log/messages 中看到任何来自 OOM killer 的消息了吗?