java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:715)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141)
原因:防火墙没有开放外界访问zookeeper的端口
解决:在防火墙配置文件中开放2181端口
1. vi /etc/sysconfig/iptables
2. 重启防火墙服务:service iptables restart