Two memcache server on local machine

398 views Asked by At

I am trying to create a demo on MemCache with multiple servers. I have installed WAMP and XAMPP on my local machine. Wamp can be accessed by localhost and XAMPP can be accessed by localhost:7980.

I have installed Memcache on both servers (correct versions are installed). On both server's phpinfo() shows memcache is installed. My one memcache server port is 11211 and second memcache server port is 11212. I am using yii2 and my configuration is as below.

'cache' => [
        'class' => 'yii\caching\MemCache',
        'servers' => [
            [
                'host' => 'localhost',
                'port' => 11211,
                'weight' => 60,
            ],
            [
                'host' => 'localhost:7980',
                'port' => 11212,
                'weight' => 60,
            ],
        ],
    ],

I am getting below error

MemcachePool::get(): Server localhost:7980 (tcp 11212, udp 0) failed with: Malformed VALUE header (0)

Please guide me where I'm going wrong. Any help will be appreciated.

1

There are 1 answers

0
Curious On

The problem is fixed by starting the server on a different port. I used below command and it worked. memcached.exe install -p 11212