Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm in the process of setting up a Resque server and am having to setup Redis for the first time. When using redis-cli to ping the remote server I get a "No route to host" error, however when I directly ping the remote server it returns ok. As I've never had much dealing with redis or for that matter much behind the scenes on a server I'm not really to sure what to do next.

[root@ss03-dev-worker bin]# redis-cli -h 10.176.x.yyy ping
Could not connect to Redis at 10.176.x.yyy:6379: No route to host

[root@ss03-dev-worker bin]# ping 10.176.x.yyy
PING 10.176.x.yyy (10.176.x.yyy) 56(84) bytes of data.
64 bytes from 10.176.x.yyy: icmp_seq=1 ttl=61 time=2.09 ms
64 bytes from 10.176.x.yyy: icmp_seq=2 ttl=61 time=0.812 ms
64 bytes from 10.176.x.yyy: icmp_seq=3 ttl=61 time=0.508 ms
^C
--- 10.176.x.yyy ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2785ms
rtt min/avg/max/mdev = 0.508/1.139/2.099/0.690 ms

I've made sure that the iptable rules on bother servers allow connections from each.

[root@ss03-dev-worker bin]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
...snip....
ACCEPT     tcp  --  10.176.x.yyy         anywhere            tcp dpt:6379

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited 

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain fail2ban-SSH (0 references)
target     prot opt source               destination       

but still can't get redis to connect. Is there anything else I need to implement?

If it makes a different, this is on Rackspace Cloud.

Edit:

The redis conf bind parameter is commented out.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Seems iptables was filtering everything out. Solution was to create a REDIS chain.

iptables -N REDIS
iptables -A REDIS -s 192.168.10.1 -j ACCEPT
iptables -A REDIS -s 192.168.10.2 -j ACCEPT
iptables -A REDIS -j LOG --log-prefix "unauth-redis-access"
iptables -A REDIS -j REJECT --reject-with icmp-port-unreachable
iptables -I INPUT -p tcp --dport 6379 -j REDIS

Hat tip to http://www.golja.org/blog/monitoring-traffic-with-iptables/

share|improve this answer
add comment

For me, I just use the Firewall GUI tool, to open the port 6379 TCP (which is being used by redis-server).

After that, I can use the redis-cli command line to connect using:

redis-cli -h <server IP> -p 6379

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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