1

I have a server that's running memcached but it's not working. So when I try to telnet to localhost through port 11211, it fails. How would I open the port?

    root@s2:/usr/local/www/production/current/log# telnet localhost 11211
    Trying 127.0.1.1...
    telnet: Unable to connect to remote host: Connection refused
bigpotato
  • 26,262
  • 56
  • 178
  • 334
  • firewall? memcache binding to the wrong ip? – Marc B Aug 28 '13 at 20:56
  • but isn't it just connecting to itself? would the firewall still interfere? and if it did, what policy would i make? source: self, destination: self, port 11211? – bigpotato Aug 28 '13 at 20:57
  • 1
    Any reason your localhost is coming up as 127.0.**1**.1? Normally it's 127.0.**0**.1 – Marc B Aug 28 '13 at 21:00
  • I think that is the reason to my problems. I'll let you know in a few minutes when I find out – bigpotato Aug 28 '13 at 21:03
  • So for some reason (don't know who did it) changed localhost to point to .1.1 in /etc/hosts. I changed it back to .0.1 and it worked after that – bigpotato Aug 28 '13 at 22:06

1 Answers1

2

The port is not the issue, it's the listening address. You need to set the listen address in memcached.conf

-l 0.0.0.0 this is not safe, but the most open

or

-l 127.0.0.1

or the actually IP address of the host (this is what I use)

-l 192.168.0.1

BTW, this is my hosts file:

127.0.0.1   localhost
127.0.1.1   myhostname
raffian
  • 31,267
  • 26
  • 103
  • 174