報錯:Zookeeper Unable to open socket to localhost/0:0:0:0:0:0:0:1:2181


報錯背景

單節點zokeeper

進入zookeeper客戶端的時候報錯:zkCli.sh

報錯現象

2020-07-03 18:39:47,943 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1112] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
2020-07-03 18:39:48,011 [myid:localhost:2181] - ERROR [main-SendThread(localhost:2181):ClientCnxnSocketNIO@287] - Unable to open socket to localhost/0:0:0:0:0:0:0:1:2181
2020-07-03 18:39:48,011 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1244] - Socket error occurred: localhost/0:0:0:0:0:0:0:1:2181: No route to host
[zk: localhost:2181(CONNECTING) 0] 2020-07-03 18:39:49,114 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1112] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)
2020-07-03 18:39:49,114 [myid:localhost:2181] - ERROR [main-SendThread(localhost:2181):ClientCnxnSocketNIO@287] - Unable to open socket to localhost/0:0:0:0:0:0:0:1:2181
2020-07-03 18:39:49,114 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1244] - Socket error occurred: localhost/0:0:0:0:0:0:0:1:2181: No route to host
2020-07-03 18:39:50,216 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1112] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2020-07-03 18:39:50,217 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@959] - Socket connection established, initiating session, client: /127.0.0.1:57616, server: localhost/127.0.0.1:2181
2020-07-03 18:39:50,224 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1394] - Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x10005b5b80d0005, negotiated timeout = 160000

WATCHER::

WatchedEvent state:SyncConnected type:None path:null

報錯原因

(1)zookeeper中少配了主機名的映射;

(2)hosts文件出現問題。

報錯解決

先檢查/etc/hosts文件中IP和主機名的映射是否正確;

再檢查/opt/apache-zookeeper-3.5.6-bin/conf/目錄下zoo.cfg文件有沒有添加如下內容,如沒有,則添上:

server.1=hadoop01:2888:3888

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM