Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
redis_unix_socket [2018/01/22 12:08]
qtwrk [for Centos 7.X]
redis_unix_socket [2018/01/22 13:53]
Lisa Clarke Proofreading and reformatting
Line 1: Line 1:
-How to use Redis in a UNIX socket+======How to use Redis in a UNIX Socket======
  
 Please use root privilege to execute the following instructions. Please use root privilege to execute the following instructions.
-If Redis fails to start , please verify SELinux is disabled , and all mentioned directories and files have correct permissions to the designated user. +If Redis fails to start, please verify SELinux is disabled , and all mentioned directories and files have correct permissions to the designated user.
  
 =====for Centos 7.X===== =====for Centos 7.X=====
  
-1Stop redis <​code>​systemctl stop redis</​code>​ +  - 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 
-2. Copy the service file +Group=username</​code> ​Change ​''​username''​ to same user that runs PHP. 
-<​code>​cp /​usr/​lib/​systemd/​system/​redis.service /​etc/​systemd/​system/​redis.service</​code>​ +  - Edit ''/​etc/​redis.conf'' ​and change ​the following<​code>​unixsocket /​path/​to/​redis.sock
- +
- +
-3. Edit ''/​etc/​systemd/​system/​redis.service''​ +
- +
- +
-<​code>​User=username +
- +
-Group=username</​code>​ +
- +
-change ​''​username''​ to same user that runs PHP +
- +
-4. Edit ''/​etc/​redis.conf''​ +
- +
-change following ​  +
- +
-<​code>​unixsocket /​path/​to/​redis.sock +
 unixsocketperm 770 unixsocketperm 770
- 
 logfile /​path/​to/​redis.log logfile /​path/​to/​redis.log
- +dir /​path/​to/​redis</​code> ​Change **port** to ''​0''​ if TCP socket is no longer needed. 
-dir /​path/​to/​redis</​code>​ +  ​- ​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 itand make sure above mentioned ''​socket path'',​ ''​log path''​and ''​dir path''​ and are writable ​by the designated user. 
-change ​''​port'' ​to 0 if TCP socket is no longer needed. +  - Start Redis. <​code>​systemctl start redis</​code>​ 
- +  ​- ​Verify it started successfully<​code>​systemctl status redis</​code>​ 
- +  ​- ​Check whether ​everything is working well<​code>​nc -U /​path/​to/​redis.sock
-5. 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 +
- +
- +
-6Now start redis. +
- +
-<​code>​systemctl start redis</​code>​ +
- +
-7. Verify it started successfully+
- +
-<​code>​systemctl status redis</​code>​ +
- +
-8. Check if everything is working well+
- +
-<​code>​nc -U /​path/​to/​redis.sock +
 info</​code>​ info</​code>​
  
  • Admin
  • Last modified: 2018/02/01 14:41
  • by Lisa Clarke