Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
redis_unix_socket [2018/01/20 21:45] qtwrk [for Centos 7.X] |
redis_unix_socket [2018/02/01 14:41] (current) Lisa Clarke |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | How to use Redis in a UNIX socket | + | #REDIRECT litespeed_wiki:cache:lscwp:configuration:cache:object_cache:redis-unix-socket |
- | + | ||
- | =====for Centos 7.X===== | + | |
- | + | ||
- | - Stop redis <code>systemctl stop redis</code> | + | |
- | + | ||
- | + | ||
- | - Copy the service file | + | |
- | <code>cp /usr/lib/systemd/system/redis.service /etc/systemd/system/redis.service</code> | + | |
- | + | ||
- | + | ||
- | - edit ''/etc/systemd/system/redis.service'' | + | |
- | + | ||
- | + | ||
- | <code>User=username | + | |
- | + | ||
- | Group=username</code> | + | |
- | + | ||
- | change ''username'' to same user that runs PHP | + | |
- | + | ||
- | - edit ''/etc/redis.conf'' | + | |
- | + | ||
- | change following | + | |
- | + | ||
- | <code>unixsocket /path/to/redis.sock | + | |
- | + | ||
- | unixsocketperm 770 | + | |
- | + | ||
- | logfile /path/to/redis.log | + | |
- | + | ||
- | dir /path/to/redis</code> | + | |
- | change ''port'' to 0 if TCP socket is no longer needed. | + | |
- | + | ||
- | + | ||
- | change owner of redis.conf to same username in step 3 | + | |
- | <code>chown username:group /etc/redis.conf</code> | + | |
- | + | ||
- | if ''/path/to/redis'' directory does not exist , please manually create it. | + | |
- | and make sure above mentioned ''socket path'', ''log path''and ''dir path'' and are writable to designated user | + | |
- | + | ||
- | + | ||
- | - now start redis. | + | |
- | + | ||
- | <code>systemctl start redis</code> | + | |
- | + | ||
- | - Verify it started successfully: | + | |
- | + | ||
- | <code>systemctl status redis</code> | + | |
- | + | ||
- | - Check if everything is working well: | + | |
- | + | ||
- | <code>nc -U /path/to/redis.sock | + | |
- | + | ||
- | info</code> | + | |
- | + | ||
- | + | ||
- | + |