问题是防火墙没关,可以在命令行做以下配置即可
假设 我所使用的端口分别为 7001,7002,7003,7004,7005,7006(根据自己端口使用情况更改端口)
红色字是需要操作的,完成就ok了
[root@bogon redis-cluster]# vim /etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 7006 -j ACCEPT # Firewall configuration written by system-config-firewall # Manual customization of this file is not recommended. *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 6379 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 7001 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 7002 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 7003 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 7004 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 7005 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 7006 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT ~ "/etc/sysconfig/iptables" 22L, 1079C written [root@bogon redis-cluster]# ll total 76 drwxr-xr-x. 2 root root 4096 Jun 7 04:01 redis01 drwxr-xr-x. 2 root root 4096 Jun 7 04:01 redis02 drwxr-xr-x. 2 root root 4096 Jun 7 03:55 redis03 drwxr-xr-x. 2 root root 4096 Jun 7 04:01 redis04 drwxr-xr-x. 2 root root 4096 Jun 7 04:01 redis05 drwxr-xr-x. 2 root root 4096 Jun 7 03:55 redis06 -rwxr-xr-x. 1 root root 48141 Jun 7 01:49 redis-trib.rb -rwxr--r--. 1 root root 270 Jun 7 02:05 start-all.sh[root@bogon redis-cluster]# service iptables restart iptables: Flushing firewall rules: [ OK ] iptables: Setting chains to policy ACCEPT: filter [ OK ] iptables: Unloading modules: [ OK ] iptables: Applying firewall rules: [ OK ]