Memcached server won’t connect

memcachedunix

I'm rather new to Unix and am trying to set up a memcached server on Rackspace Cloud Servers with CentOS 5.4. I've been following the guide below.

http://centoshacker.com/kabir/tuning/setting-up-memcached-distributed-caching-system.html

I think I have everything set up, but it looks like im missing something. When I run "top" the memcached process is there. But when I try to connect to the server from PHP i get the following error.

Memcache::connect() [<a href='memcache.connect'>memcache.connect</a>]: Can't connect to 111.111.111.111:11211, A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.(10060)

I am connecting from a different server and I'm using the memcached server IP and port.

Here is the string I used to run memcached.

/usr/local/bin/memcached -d -m 200 -p 11211 -c 20480 -u root

I set a different port than that, but I want to keep it secret 😉

Any thoughts on what I did wrong, or some ideas on how I can test/troubleshoot the server? Or any pointers in general for a total noob like me?

Thanks in advance!

Best Answer

Would this "secret" port be the 23232 seen in your error message?

memcached runs over a plain,cleartext tcp connection.

try telneting to your memcached server and issuing the stats command like so:

justin@bert ~ % telnet lois 11211
Trying .....
Connected to lois...
Escape character is '^]'.
stats
STAT pid 3174
STAT uptime 665105
...

get that to work first, then get php to work with it.

also, since memcached uses a cleartext protocol with no encryption, it is not something you want running on an internet facing server.