0

I am not able to connect to my Redis server from remote AWS instance (both instances are in same VPC though)...

I have launched CentOS 6 instance and launched Redis server. I can confirm that server is running:

tcp 0 0 *:6379 *:* LISTEN 891/redis-server *
tcp 0 0 *:6379 *:* LISTEN 891/redis-server *

I have set AWS security group to be:

Custom TCP | port 6379 | 0.0.0.0/0

I am able to connect to the Redis server from the same instance using redis-cli but when I try to do it from some other AWS instance I get:

Could not connect to Redis at ec2-*.compute.amazonaws.com:6379: No route to host
asked Jun 23, 2015 at 8:57
3
  • The bind options in redis config is commented... What do you suggest I should put in order to support remote connections? Commented Jun 23, 2015 at 11:48
  • 1
    @ItamarHaber that's the exact opposite of the truth. 0.0.0.0 means that connections are accepted on all network interfaces. Commented Jun 26, 2015 at 6:15
  • @hobbs you're right of course - Oops. Commented Jun 26, 2015 at 14:03

2 Answers 2

1
+100

Seems like you are using 127.0.0.1 IP for binding instead of 0.0.0.0. Open your /etc/redis.conf and check bind option.

answered Jun 23, 2015 at 11:14
Sign up to request clarification or add additional context in comments.

1 Comment

The bind option was commented, I have put the bind 0.0.0.0. Now netstat gives me column Program name with a bit different output: 1181/redis-server 0 . If you can check first comment on the question, Itamar is suggesting opposite? Any idea what is going on?
1

Turns out firewall was on, so it wasn't possible to connect from outside. So to wrap it up:

1.Set Redis to allow remote connections by setting bind 0.0.0.0 in redis.conf

2.Make sure the firewall is not preventing you to connect to your server. On AWS you can turn it off by:

sudo service iptables save
sudo service iptables stop
sudo chkconfig iptables off
answered Jun 26, 2015 at 6:59

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.