Problems to connect with remote redis-server

4

1

I have two Amazon-EC2 instance let's say A and B. B has redis-server installed.

I want to access B from A So I am trying

A$ redis-cli -h B_ip -p 6379
Could not connect to Redis at B_ip:6379: Connection timed out
Could not connect to Redis at B_ip:6379: Connection timed out

My workaround :

I changed /etc/redis/redis.conf

bind 127.0.0.1    ---->   bind 0.0.0.0

Then I restarted redis-server but the issue is persistent

More informations :

B$ netstat -nlpt | grep 6379
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:6379                0.0.0.0:*                   LISTEN      -  

Please help.

Progress :

I searched and found to remove bind at all to get connected from external ip. But again not working. I tried to replace bind 0.0.0.0 with private_ip_of_B but still not working.

Avinash

Posted 2017-02-10T03:12:36.070

Reputation: 183

Answers

4

Port 6379 doesn't need to be open for the EC2 servers, but it does need to be open for the Redis server.

Can you check that port is 6379 opened in your AWS security group. And try again.

And make sure you are using private ip not the public one.

dsa

Posted 2017-02-10T03:12:36.070

Reputation: 56

Yep, this worked for me. In my case, even though the port and IP was open properly, I was connecting to the external AWS IP. Thanks – user9869932 – 2018-05-28T21:29:58.370

In my case I was trying to connect to the public IP, thanks :) – Srinivas Gowda – 2018-06-18T10:22:08.787