当ping远程redis主机时,redis“没有路由到主机”

我正在设置一个Resque服务器,并且需要首次安装Redis。 当使用redis-cli来ping远程服务器时,我得到一个“No route to host”错误,但是当我直接ping远程服务器时,它返回ok。 由于我从来没有处理过redis,或者在服务器的幕后,我不太确定接下来要做什么。

[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 

我已经确定,麻烦的服务器上的iptable规则允许从每个连接。

 [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 

但仍然无法获得redis连接。 还有什么我需要实现?

如果它不同,这是在Rackspace云。

编辑:

redis conf conf参数被注释掉了。

似乎iptables正在过滤一切。 解决scheme是创build一个REDIS链。

 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 

帽子提示http://www.golja.org/blog/monitoring-traffic-with-iptables/

对我来说,我只是使用防火墙GUI工具来打开端口6379 TCP(redis-server使用的端口)。

之后,我可以使用redis-cli命令行连接使用:

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