PROBLEM
I am using memcached for my sessions on my multiserver setup. Session data is not shared between servers.
ENVIRONMENT
- On-Premise Server + WebMail Multi-Server Installations: Version 7.5.2+
- WebMail Only Multi-Server Installations: Version 7.5.2+
CAUSE
Memcached not configured for multiserver use.
RESOLUTION
Install memcached via:
yum install memcached.x86_64
Update config for memcached via vi /etc/sysconfig/memcached
Find the following line:
options=""
Update this line with the interface you wish memcached to listen on e.g:
options="-l 10.0.10.3"
Do this on every server you're running memcached on.
Update the lines ";session.save_path = "/tmp""
and "session.save_handler = files"
in /etc/php.ini
with:
session.save_handler = memcache
session.save_path = 'tcp://10.0.10.1:11211,tcp://10.0.10.2:11211,tcp://10.0.10.3:11211'
Create a file within /etc/php/conf.d/
called memcached.ini and add the following:
extension=memcache.so
memcache.allow_failover=1
memcache.session_redundancy=4
memcache.session_redundancy should be your total memcached servers +1, in this example we have 3 so memcache.session_redundancy is 4. If you had 4 memcached servers, the value would be 5.
Once this is done, run:
service httpd restart
Your memcached system should now be OK and you should now be able to set memcached as your session system within webadmin, adding each IP into the host section.
Comments