Search code examples
ruby-on-railsmemcacheddalli

telnet localhost 11211 fails. How to open the port?


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

Solution

  • 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