This is an old revision of the document!


How to use Redis in a UNIX socket

  1. Stop redis
    systemctl stop redis
  1. Copy the service file
cp /usr/lib/systemd/system/redis.service /etc/systemd/system/redis.service
  1. edit /etc/systemd/system/redis.service
User=username

Group=username

change username to same user that runs PHP

  1. edit /etc/redis.conf

change following

unixsocket /path/to/redis.sock

unixsocketperm 770

logfile /path/to/redis.log

dir /path/to/redis

change port to 0 if TCP socket is no longer needed.

change owner of redis.conf to same username in step 3

chown username:group /etc/redis.conf

if /path/to/redis directory does not exist , please manually create it. and make sure above mentioned socket path, log pathand dir path and are writable to designated user

  1. now start redis.
systemctl start redis
  1. Verify it started successfully:
systemctl status redis
  1. Check if everything is working well:
nc -U /path/to/redis.sock

info
  • Admin
  • Last modified: 2018/01/20 21:45
  • by qtwrk