0

I am reading the documentation regarding memcache failover and it is my understanding that it should work automatically, if memcache.allow_failover = 1

However, it is not working in my case

public function __construct(array $settings) {
        $this->link = new \Memcache();
        foreach($settings['servers'] as $server){
            list($server, $port, $weight) = explode(':', $server);
            $this->link->addServer($server, (int) $port, 0, (int) $weight);
        }
    }
the servers array is like this
["slave01:11211:1","slave02:11211:1"]

Once I stop one of them and try to write something, I get an exception that memcache cannot connect to the server I am using pecl-memcache 2.2.7

Any ideas?

Thanks

Thomas
  • 4,641
  • 13
  • 44
  • 67
  • Is memcache.failover a typo? The real ini directive is memcache.allow_failover: http://php.net/manual/en/memcache.ini.php – Lajos Veres Oct 01 '13 at 11:36
  • Typo yes. Will fix it. Anyway I did not change this directive since it is true by default – Thomas Oct 01 '13 at 11:48
  • This can be useful: http://stackoverflow.com/questions/11778495/memcache-confusions – Lajos Veres Oct 01 '13 at 11:58
  • I have already read it and according to 2.1 failover should do what it says, but not in my case – Thomas Oct 01 '13 at 12:01
  • 1
    It says you will get a USER_NOTICE anyway. Isn't this causing the issue? You can suppress it by prefixing the command with an @. – Lajos Veres Oct 01 '13 at 12:04
  • OMG. %$%$^$$^&()^. I was seeing xdebug's notice rendering and confused it for an error. Sorry for that. Thanks a lot Lajos – Thomas Oct 01 '13 at 12:44

0 Answers0