开启防火墙
在每台服务器的 /etc/sysconfig/iptables 中加入以下几行
代码语言:javascript复制-A INPUT -p tcp -m state --state NEW -m tcp --dport 2180 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8000 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8100 -j ACCEPT
然后重载一下
代码语言:javascript复制[root@h101 zk]# vim /etc/sysconfig/iptables
[root@h101 zk]# /etc/init.d/iptables reload
iptables: Trying to reload firewall rules: [ OK ]
[root@h101 zk]#
可以使用 iptables -L -nv
进行检查,filter 表中包含以下几行的,为已经生效
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:2180
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:8000
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:8100
启动服务
代码语言:javascript复制[root@h101 zk]# zookeeper-3.4.6-real/bin/zkServer.sh start
JMX enabled by default
Using config: /root/zk/zookeeper-3.4.6-real/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@h101 zk]#
----------
[root@h102 zookeeper-3.4.6-real]# zookeeper-3.4.6-real/bin/zkServer.sh start
JMX enabled by default
Using config: /root/zk/zookeeper-3.4.6-real/zookeeper-3.4.6-real/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@h102 zookeeper-3.4.6-real]#
----------
[root@redis-b zookeeper-3.4.6-real]# zookeeper-3.4.6-real/bin/zkServer.sh start
JMX enabled by default
Using config: /root/zk/zookeeper-3.4.6-real/zookeeper-3.4.6-real/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@redis-b zookeeper-3.4.6-real]#