启动zookeeper 客户端的时候,莫名的报
<pre class="html" name="code">2016-10-11 05:31:17,786 [myid:] - INFO [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@78c8a027
2016-10-11 05:31:17,829 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@966] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)
在网上查了下一般说是 /etc/hosts 文件配置有错。或者是zoo.cfg 有错,但是我反复检查了这俩个配置文件,不管是ip还是主机名都没有错。实在找不到原因,后来在stackoverflow上看到老外回答说是有可能是防火墙未关闭,我顿时恍然大悟,估计问题就出在这里。后来我去把防火墙关闭,果然好了。经过试验,如果Leader down掉了,其他的机器不能选举,也有可能是有一台机器防火墙没有关闭。
检查防火墙状态:service iptables status
暂时关闭防火墙:service iptables stop
永久关闭防火墙:chkconfig iptables off