Hi everyone
I am very happy with memcached which I have used the last few years in
a production environment. But now I turn to you, because the latest
server added, does not work as expected regarding memcached. Actually
I am not sure if this is the correct list to ask, but here goes...
We have 5 webservers all running a website written in PHP. 3 of them
acts as both memcache server and client. 2 of them are memcache
clients only.
Server #5 (client only) was added a few weeks ago. This server
connects to the server pool just fine, but can't seem to fetch values.
I made this test script to illustrate the problem:
---------------------------------------------------------------
<?php
error_reporting(E_ALL);
//Create 3 memcache objects..
$memcache1 = new Memcache;
$memcache2 = new Memcache;
$memcache3 = new Memcache;
//Add one server to each object
$memcache1->addServer('10.0.0.100', 11211);
$memcache2->addServer('10.0.0.181', 11211);
$memcache3->addServer('10.0.0.182', 11211);
//Let each object fetch 2 values from memcache
$total1 = $memcache1->get('www_profiles_total');
$total2 = $memcache2->get('www_profiles_total');
$total3 = $memcache3->get('www_profiles_total');
$onl1 = $memcache1->get('www_profiles_online');
$onl2 = $memcache2->get('www_profiles_online');
$onl3 = $memcache3->get('www_profiles_online');
echo "<p>This page is served from web5</p>";
//Lets se what the values contain
echo "<p><b>Web1 v".$memcache1->getVersion()."</b><br>Profiles:
$total1,
Online: $onl1</p>";
echo "<p><b>Web2 v".$memcache2->getVersion()."</b><br>Profiles:
$total2,
Online: $onl2</p>";
echo "<p><b>Web3 v".$memcache3->getVersion()."</b><br>Profiles:
$total3,
Online: $onl3</p>";
//Create a memcache object with a server pool
//(this is the way we would normally do it):
$memcache = new Memcache;
$memcache->addServer('10.0.0.100', 11211);
$memcache->addServer('10.0.0.181', 11211);
$memcache->addServer('10.0.0.182', 11211);
$total = $memcache->get('www_profiles_total');
$onl = $memcache->get('www_profiles_online');
echo "<p><b>All v".$memcache->getVersion()."</b><br>Profiles: $total,
Online: $onl</p>";
------------------------------------------------
... and the output from the above is:
------------------------------------------------
This page is served from web5
Web1 v1.4.5
Profiles: 33395, Online:
Web2 v1.4.5
Profiles: , Online:
Web3 v1.4.5
Profiles: , Online: 230
All v1.4.5
Profiles: , Online:
-------------------------------------------------
Note that the values in the last line is empty, it was expected to
look like this:
Profiles: 33395 , Online: 230
... for some reason, I get nothing if all servers are in a pool, and
this only happens for client #5.
Here is some version info... Note that the client on #5 is newer than
the others.
------------------------------------------------
1)
FreeBSD 6.0-RELEASE
Memcached 1.4.5
Pecl-Memcache 2.2.3
2)
FreeBSD 7.0-STABLE
Memcached 1.4.5
Pecl-Memcache 2.2.3
3)
FreeBSD 7.0-STABLE
Memcached 1.4.5
Pecl-Memcache 2.2.3
4)
FreeBSD 7.0-STABLE
Pecl-Memcache 2.2.3
5)
FreeBSD 8.0-RELEASE
Pecl-Memcache-3.0.4
----------------------------------------------------
I assume the issue is client related? Any ideas?
Thanks :-)
Marie