I am facing issue in session storage on memcache on both servers. I installed memcached on cloud servers
I have two servers "server 1" and "server 2" and two loadbalancers one is if for port 443 and another is for 80. I want to keep session in memcache on both servers so if one server goes down, the server 2 should show same session.
I installed memcache on both servers by following commands:
1) rpm -Uvh http://mirrors.kernel.org/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
2) yum install memcached
3) vi /etc/sysconfig/memcached and added
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="264"
OPTIONS="-l 127.0.0.1" // I tried here by putting server 1's ip on server 1 memcache config file and server 2's ip on server 2 memcache config file
4) /etc/init.d/memcached start
5) chkconfig --levels 235 memcached on
6) yum groupinstall "Development Tools"
7) yum install zlib-devel libmemcached-devel php-pear php-pecl-memcached php-pecl-memcache
8) pecl install -f memcached-1.0.0
After this memcache.ini and memcahed.ini were added to my server
I opened memcache.ini and changed below settings:
1) memcache.hash_strategy=consistent
2) memcache.session_redundancy=3
3) memcache.allow_failover=1
and in php.ini, I changed
1) session.save_handler = memcache
2) session.save_path = tcp://server1:11211,tcp://server2:11211
and restarted apache server
You can see all the configuration settings here: http://www.diehardfans.com/phpinfo.php
Now on site when I am trying to write/read session it shows error:
Warning: session_write_close() [function.session-write-close]: Failed to write session data (memcache). Please verify that the current setting of session.save_path is correct (tcp://server1:11211,tcp://server2:11211) in /mnt/cbsvolume1/sporters/library/Zend/Session.php on line 702
P.S: 11211 port is open on cloud passage and we are using round robin algorithm on load balancer.
Please check and let us know if we are doing any mistake.
Thanks In Advance