0

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

 ssh -f -N user@56.55.55.56 -L 11211:127.0.0.1:11211

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

tcp        0      0 127.0.0.1:11211    0.0.0.0:*    LISTEN      976/ssh

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

telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to 127.0.0.1.
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 127.0.0.1 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

2
  • 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 192.168.3.106:11211 0.0.0.0:* LISTEN 1031/memcached – Paul Bedorf Apr 4 '16 at 20:41
0

do a:

 ssh -f -N user@56.55.55.56 netstat -putan 

should show you something LISTENing in 127.0.0.1:11211 (or 0.0.0.0:11211) 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@56.55.55.56 -L 11211:192.168.3.106:11211
  2. make memcache listen to 127.0.0.1 i.e.: you start the service with memcached -l 127.0.0.1 (or it's corresponding /etc/default/memcached in ubuntu/debian)
2
  • 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 0.0.0.0:5432 by default. Memcache doesn't (it chooses an specific address, which I guess in your case is 192.168.3.106) can you paste the output of ssh -f -N user@56.55.55.56 netstat -putan ? – nicocesar Apr 6 '16 at 0:49
0

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.