Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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!

share|improve this question

2 Answers 2

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.

share|improve this answer
    
doh! that is the port of course. ill give telnet a try shortly and see how it goes –  Pepper Mar 4 '10 at 3:01
    
Looks like it working through telnet. Anything specific I should be looking for in the response? telnet 111.111.111.111 11211 Trying 111.111.111.111... Connected to 111.111.111.111. Escape character is '^]'. stats STAT pid 1070 STAT uptime 5686 STAT time 1267671846 –  Pepper Mar 4 '10 at 3:09
    
ah, I get it. I ran some set and get commands while connected through telnet. It seems to be working from there. Could this be a firewall configuration issue or something? –  Pepper Mar 4 '10 at 3:30
    
If it was a firewall configuration issue you would not be able to telnet to the server and run the stats command. –  Justin Mar 4 '10 at 4:56
up vote 0 down vote accepted

I found the answer here.

http://gavinbenda.com.au/2007/04/17/open-a-port-with-centos/

Needed to allow the port in iptables. If someone else has this issue, make sure to read the comment on that post. The entry needs to be added before the second last line.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.