I have created a SSH Tunnel to my memcached server as follows:

 ssh -f -N user@ -L 11211:

When i do netstat on my machine i get the following: So far looks good.

tcp        0      0*    LISTEN      976/ssh

The issue shows up when I telnet to the server as follows:

telnet 11211
Connected to
Escape character is '^]'.
channel 2: open failed: connect failed: Connection refused
Connection closed by foreign host.

So I went to the memcached server and tailed the auth.log file and found this message overytime i try to telnet to the server:

Apr  4 13:56:06 vmcachd sshd[1410]: error: connect_to port 11211: failed.

Does anyone know what is the issue, I have a similar setup with postgresql and it works perfectly fine! Any help is appreciated.

Thank You

  • Are you sure memcached is running on the server? – Tero Kilkanen Apr 4 '16 at 18:46
  • Hi Tero, yes it is running I have included the output of netstat -tulpn tcp 0 0* LISTEN 1031/memcached – Paul Bedorf Apr 4 '16 at 20:41

do a:

 ssh -f -N user@ netstat -putan 

should show you something LISTENing in (or check the column "Local Address"

if you see something else (like listening in another interface) there are 2 options:

  1. you change the tunnel to listen to that interface i.e.: ssh -f -N user@ -L 11211:
  2. make memcache listen to i.e.: you start the service with memcached -l (or it's corresponding /etc/default/memcached in ubuntu/debian)
  • Hello, I run that command but it does not return anything. I also run this command on my another server where I do ssh tunnel to Postgresql and it also comes back with nothing. That postgresql ssh tunnel that i have set up works perfectly. – Paul Bedorf Apr 4 '16 at 20:43
  • postgress listens in by default. Memcache doesn't (it chooses an specific address, which I guess in your case is can you paste the output of ssh -f -N user@ netstat -putan ? – nicocesar Apr 6 '16 at 0:49

I appreciate your help, I have solved the issue by reinstalling the latest Centos 7 operating system with the latest memcache server, everything works perfectly now. Before my memcache server was running on an older version of Debian 6.0.6/squeeze, not sure if that had anything to do with it, but surely the reinstall of the latest os solved my issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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