1.問題現象。 啓動每個都提示 STARTED 可是查看 status時所有節點都報錯java
2.打印日誌 看報錯 所有節點都報這個錯誤node
tail -1000f zookeeper.out
3.網上尋求解決方案apache
1.http://freeman983.iteye.com/blog/2053037 log目錄沒有建立致使出錯 並非緣由。socket
2.http://blog.csdn.net/qianggezhishen/article/details/49363349 (個人配置都是對的 可是仍然報錯)spa
ZooKeeper安裝使用時遇到各類奇怪問題的解決方法:.net
1.nohup:failed to run command ‘Java’: No such file or directory
2.Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
日誌
a.檢查myid文件數字是否跟配置的能對的上code
b.檢查myid文件是否已經拷貝到dataDIr配置的路徑裏了orm
c.檢查/etc/profile和/etc/environment 是否設置了Java和Zookeeper的路徑server
d.Zookeeper集羣節點必須是3個以上
3.仍是 歪果仁給力 stackoverflow 查到解決方案:
http://stackoverflow.com/questions/30940981/zookeeper-error-cannot-open-channel-to-x-at-election-address
例如:
server.1=0.0.0.0:2888:3888 server.2=192.168.10.10:2888:3888 server.3=192.168.2.1:2888:3888
Step 1:
Node 1:
zoo.cfg
server.1= 0.0.0.0:<port>:<port2>
server.2= <IP>:<port>:<port2>
.
.
.
server.n= <IP>:<port>:<port2>
Node 2 :
server.1= <IP>:<port>:<port2>
server.2= 0.0.0.0:<port>:<port2>
.
.
.
server.n= <IP>:<port>:<port2>
如願看到:
若是遇到 java.net.NoRouteToHostException: No route to host
建議關閉防火牆試試
Java.net.NoRouteToHostException:No route to host
上網查詢的結論以下:
沒有路由鏈接到本機,沒法到達遠程主機,
緣由:防火牆干擾或中間路由器停機
(用telnet查看該機器是否正常鏈接,結果以下:
Trying 199.155.122.91...
telnet: connect to address 199.155.122.91: No route to host
telnet: Unable to connect to remote host: No route to host)
解決的辦法是:和防火牆規則有關,關閉防火牆就能夠了
關閉防火牆以後,結果以下:
Trying 199.155.122.91...
telnet: connect to address 199.155.122.91: Connection refused
telnet: Unable to connect to remote host: Connection refused
http://blog.csdn.net/chenyi8888/article/details/8552860