注意:此方法是学习redis时发现的,如果是生产环境,请考虑其他方式。
引起这个问题的原因是防火墙:
[root@localhost bin]# ./redis-cli -h 192.168.25.153 -p 6379
Could not connect to Redis at 192.168.25.153:6379: No route to host
not connected> quit
[root@localhost bin]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
[root@localhost bin]#