Memcached can run in a UNIX socket, which provides better performance than a TCP connection.
Note: If Memcached fails to start, it is usually due to permission and user problems. Please use root privilege to execute the following instructions, and verify that the socket path is writable to the designated user.
systemctl stop memcached
cp /usr/lib/systemd/system/memcached.service /etc/systemd/system/memcached.service
/etc/sysconfig/memcached
, changing the path to your desired location, and the username to the same one used in Step 3: OPTIONS="" USER="memcached"
becomes
OPTIONS="-s /path/to/memcached.sock -a 0770" USER="username"
systemctl start memcached
systemctl status memcached
nc -U /path/to/memcached.sock stats
getenforce
Enforcing
: setenforce 0
(reboot will re-enable selinux)
/etc/selinux/config
, change enforcing
to permissive
ordisabled
and then reboot.systemctl stop memcached
/etc/sysconfig/memcached
and change OPTIONS="" USER=""
to
OPTIONS="-s /path/to/memcached.sock -a 0770" USER="username"
where USER is the same user that runs PHP.
service memcached start
nc -U /path/to/memcached.sock stats
getenforce
Enforcing
: setenforce 0
(reboot will re-enable selinux)
/etc/selinux/config
, change enforcing
to permissive
ordisabled
and then reboot.systemctl stop memcached
/etc/memcached.conf
, comment out host and port, add socket path and permission -s /path/to/memcached.sock -a 0770
and change -u memcache
to -u username
where username
is the same user that runs PHP.
systemctl start memcached
nc -U /path/to/memcached.sock stats
service memcached stop
/etc/memcached.conf
, comment out host and port, add socket path and permission -s /path/to/memcached.sock -a 0770
and change -u memcache
to -u username
where username
is the same user that runs PHP.
service memcached start
nc -U /path/to/memcached.sock stats