I have a CentOS 7 server with Memcached. There are a lot of requests, and usually after a few hours, the memcached daemon crashes. I always restart the service, but it crashes again a few hours later.
The /var/log/memcached.log file is empty.
These are the /etc/sysconfig/memcached settings:
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="32"
OPTIONS="-vv >> /var/log/memcached.log 2>&1"
journalctl -u memcached throws this result (strangely, the last log dates are from december, but i've been restarting the memcached service every single day in january).
Dec 10 23:59:32 myserver systemd[1]: Started Memcached.
Dec 10 23:59:32 myserver systemd[1]: Starting Memcached...
Dec 13 16:44:07 myserver systemd[1]: memcached.service: main process exited, code=killed, status=9/KILL
Dec 13 16:44:07 myserver systemd[1]: Unit memcached.service entered failed state.
Dec 13 16:44:07 myserver systemd[1]: memcached.service failed.
Dec 14 22:22:41 myserver systemd[1]: Started Memcached.
Dec 14 22:22:41 myserver systemd[1]: Starting Memcached...
Dec 15 19:35:50 myserver systemd[1]: memcached.service: main process exited, code=killed, status=9/KILL
Dec 15 19:35:50 myserver systemd[1]: Unit memcached.service entered failed state.
Dec 15 19:35:50 myserver systemd[1]: memcached.service failed.
systemctl cat memcached.service
[Unit]
Description=Memcached
Before=httpd.service
After=network.target
[Service]
Type=simple
EnvironmentFile=-/etc/sysconfig/memcached
ExecStart=/usr/bin/memcached -u $USER -p $PORT -m $CACHESIZE -c $MAXCONN $OPTION
[Install]
WantedBy=multi-user.target
After a few hours of visitor requests, the apache log error starts displaying this errors, one after the other:
[Wed Jan 08 11:17:11.017280 2020] [:error] [pid 15793] [client X.X.X.X:22992] PHP Warning: Memcache::connect(): Can't connect to localhost:11211, Connection refused (111) in /www/html/inc/functions.php on line X
These are the memcached settings with a php 5.6.30 environment:
How could I properly detect what's causing the fail/crash behavior?