Memcached error: SERVER HAS FAILED AND IS DISABLED UNTIL TIMED RETRY

Here is my test code:

$host = 'localhost';
$port = '11211';

if (extension_loaded('memcached')) {
    $mc = new Memcached;
    $mc->addServer($host, $port);
    if ($mc->set('test', 'TEST')) {
        echo 'true';
    } else {
        echo $mc->getResultCode();
        echo $mc->getResultMessage();
    }
} else {
    echo 'no_memcached';
}

The output is:

47 SERVER HAS FAILED AND IS DISABLED UNTIL TIMED RETRY

SELinux is disabled, I've also tried to turn off tcp_nodelay in nginx.conf and tried different types of host (127.0.0.1 and localhost) and ports.

I've read this question - How to debug memcached "SERVER HAS FAILED AND IS DISABLED UNTIL TIMED RETRY" errors?

But nothing helped and I cannot comment, because I have not enough points.


Solution 1:

It can be different problems why it's not run.

In my case, I realized that memcached service is not started in docker container.

So, first - check if memcached actually works and check it logs. Try to connect to memcached (on default location)

telnet localhost 11211