My activities New request

contact atmail support

PH: +61 (7) 5357-6605

support@atmail.com

Follow

Memcached Sessions Multi Server Setup

Chris -

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:

-l 127.0.0.1

Replace with your private IP e.g:

-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.

Have more questions? Submit a request

Comments