Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
memcached_unix_socket [2018/01/17 21:19]
qtwrk
memcached_unix_socket [2018/01/17 22:45]
qtwrk [for Ubuntu 14.04 and Debian 7]
Line 4: Line 4:
  
  
-Please use root privilege to the following instructions,​ and SELinux needs to be disabled+ 
 +=====Note===== 
 +Please use root privilege to the following instructions
 + 
 +If memcached failed to start it is usually due to permission ​and user problem , please check the socket path is writable ​to designated user. 
 =====for Centos7.X===== =====for Centos7.X=====
  
Line 11: Line 15:
 2. Copy file service file <​code>​cp /​usr/​lib/​systemd/​system/​memcached.service /​etc/​systemd/​system/​memcached.service</​code>​ 2. Copy file service file <​code>​cp /​usr/​lib/​systemd/​system/​memcached.service /​etc/​systemd/​system/​memcached.service</​code>​
  
-3. Add following content to /​etc/​systemd/​system/​memcached.service ,after [Service], please change username to php user+3. Add following content to /​etc/​systemd/​system/​memcached.service ,after [Service], please change username to the same user that runs PHP
 <​code>​User=username <​code>​User=username
 Group=username Group=username
Line 40: Line 44:
 2. Edit /​etc/​sysconfig/​memcached 2. Edit /​etc/​sysconfig/​memcached
 change <​code>​OPTIONS=""</​code>​ to <​code>​OPTIONS="​-s /​path/​to/​memcached.sock -a 0770"</​code>​ change <​code>​OPTIONS=""</​code>​ to <​code>​OPTIONS="​-s /​path/​to/​memcached.sock -a 0770"</​code>​
-change <​code>​USER=""</​code>​ to <​code>​USER="​username"</​code>​ the same user runs php+change <​code>​USER=""</​code>​ to <​code>​USER="​username"</​code>​the same user that runs PHP
  
-3. Edit /​etc/​init.d/​memcached +3. Start memcached <​code>​service memcached start</​code>​
-change ​<​code></​code>​+
  
- +4. Check if everything goes well.
-4. Start memcached <​code>​service memcached start</​code>​ +
- +
-5. Check if everything goes well.+
 <​code>​nc -U /​path/​to/​memcached.sock</​code>​ <​code>​nc -U /​path/​to/​memcached.sock</​code>​
 and then type <​code>​stats</​code>​ and then type <​code>​stats</​code>​
Line 56: Line 56:
  
 2. Edit <​code>/​etc/​memcached.conf</​code>​comment out host and port , add socket path and permission. 2. Edit <​code>/​etc/​memcached.conf</​code>​comment out host and port , add socket path and permission.
-<​code>​-s /tmp/​memcached.sock +<​code>​-s /path/to/​memcached.sock 
--a 755</​code>​+-a 0770</​code>​ 
 +and change <​code>​-u memcache</​code>​ to <​code>​-u username</​code>​ 
 +the same user that runs PHP 
  
-{{ :​litespeed_wiki:​cache:​lscwp:​configuration:​mem-socket-ubuntu1.png?​direct |}} 
  
 3. Start memcached again <​code>​systemctl start memcached</​code>​ 3. Start memcached again <​code>​systemctl start memcached</​code>​
  
 4. Check if everything goes well. 4. Check if everything goes well.
-<​code>​nc -U /tmp/​memcached.sock</​code>​+<​code>​nc -U /path/to/​memcached.sock</​code>​
 and then type <​code>​stats</​code>​ and then type <​code>​stats</​code>​
  
Line 73: Line 75:
  
 2. Edit <​code>/​etc/​memcached.conf</​code>​comment out host and port , add socket path and permission. 2. Edit <​code>/​etc/​memcached.conf</​code>​comment out host and port , add socket path and permission.
-<​code>​-s /tmp/​memcached.sock +<​code>​-s /path/to/​memcached.sock 
--a 755</​code>​ +-a 0770</​code>​ 
-Add additional line on Ubuntu 14.04 +and change ​<​code>​-u ​memcache</​code> ​to <​code>​-u username</​code>​ 
-<​code>​-u ​root</​code>​ +the same user that runs PHP
- +
-{{ :​litespeed_wiki:​cache:​lscwp:​configuration:​mem-socket-ubuntu1.png?​direct |}}+
  
 3. Start memcached again <​code>​service memcached start</​code>​ 3. Start memcached again <​code>​service memcached start</​code>​
  
 4. Check if everything goes well. 4. Check if everything goes well.
-<​code>​nc -U /tmp/​memcached.sock</​code>​+<​code>​nc -U /path/to/​memcached.sock</​code>​
 and then type <​code>​stats</​code>​ and then type <​code>​stats</​code>​
- 
- 
- 
- 
- 
- 
-======FAQ====== 
- 
-If memcached failed to start , it usually due to permission and user problem , please check the socket path is writable to user designated. ​ 
- 
- 
- 
- 
-sources: 
- 
-https://​www.orangecoat.com/​how-to/​run-memcached-as-a-socket-under-systemd-in-centos-or-rhel-7 
- 
-https://​chirale.org/​2015/​09/​04/​installing-and-configure-memcache-on-centos-7/​ 
- 
-https://​guides.wp-bullet.com/​install-latest-memcached-object-cache-wordpress-php5-debian/​ 
  • Admin
  • Last modified: 2018/01/18 15:56
  • by Lisa Clarke