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

bug*_*com 4 redis

我正在设置 Resque 服务器,并且必须第一次设置 Redis。当使用 redis-cli ping 远程服务器时,我收到“No route to host”错误,但是当我直接 ping 远程服务器时,它返回正常。由于我从来没有在服务器上处理过很多 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
Run Code Online (Sandbox Code Playgroud)

我已经确保打扰服务器上的 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       
Run Code Online (Sandbox Code Playgroud)

但仍然无法让redis连接。还有什么我需要实施的吗?

如果它有所不同,这是在 Rackspace Cloud 上。

编辑:

redis conf 绑定参数被注释掉了。

bug*_*com 8

似乎 iptables 正在过滤所有内容。解决方案是创建一个 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
Run Code Online (Sandbox Code Playgroud)

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