0

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!

Pepper
  • 103
  • 5

2 Answers2

0

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.

Justin
  • 3,856
  • 18
  • 21
  • doh! that is the port of course. ill give telnet a try shortly and see how it goes – Pepper Mar 04 '10 at 03: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 04 '10 at 03: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 04 '10 at 03: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 04 '10 at 04:56
0

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.

Pepper
  • 103
  • 5