ambersariya
ambersariya

Reputation: 83

Repcached (failover doesn't seem to work)

Been working on the replication of sessions. i downloaded and installed memcached+repcached. now i have no problem replicating data across the two servers while they're both up and running and i have Confirmed this via telnet (telnet 127.0.0.1 11211)

However, when in php environment, there does seem to be an issue once one of the machines goes down.

I have the memcache.allow_failover=1 set in the memcache.ini.

I decided not to change the php.ini. i am using the ini_set function to set the save_path and the save handler. I also have an instance of memcached (repcache patched) on each of the servers. When I take down server1, I keep getting a php Warning (apache error log) and the browser sits there waiting for it's memcached server to come back up and at this point it seems like it's not re-routing the memcache storage to the other server. even though all the session data is actually being replicated. (is there a master slave issue?)

PHP Warning: Unknown: Failed to write session data (memcached). Please verify that the current setting of session.save_path is correct (127.0.0.1:11211,191.168.100.4:11211) in Unknown on line 0,

Server 1

$cache_servers = array(
        "127.0.0.1:11211",
        "192.168.100.3:11211"
    );
    ini_set('session.save_handler', 'memcached');
    ini_set('session.save_path', implode(',', $cache_servers));

/usr/local/bin/memcached -u nobody -p 11211 -m 64 -x 192.168.100.4 -vv

Server 2

    $cache_servers = array(
        "127.0.0.1:11211",
        "192.168.100.4:11211",
    );
    ini_set('session.save_handler', 'memcached');
    ini_set('session.save_path', implode(',', $cache_servers));

/usr/local/bin/memcached -u nobody -p 11211 -m 64 -x 192.168.100.3 -vv

If i've got the concept wrong or whatever it is, please help. Thank you in advance.

Upvotes: 2

Views: 991

Answers (1)

donis
donis

Reputation: 523

It seems you are using memcached extension, but changing memcache options. They are different!

memcacheD extension up to version 2 doesn't support failover. Either use memcache extension or upgrade memcacheD to version 2.0 (though it is still in beta).

Upvotes: 2

Related Questions