使用管理员的权限就可以了 sudo ./bin/zkServer.sh start
之前的报错
lnfxcf@lnfxcf:~/zookeeper-3.4.12$ ./bin/zkCli.sh -server ubuntu-zookeeper-01:2181
Connecting to ubuntu-zookeeper-01:2181
2018-11-20 08:22:40,065 [myid:] - INFO [main:Environment@100] - Client environment:zookeeper.version=3.4.12-e5259e437540f349646870ea94dc2658c4e44b3b, built on 03/27/2018 03:55 GMT
2018-11-20 08:22:40,069 [myid:] - INFO [main:Environment@100] - Client environment:host.name=220.250.64.225
2018-11-20 08:22:40,069 [myid:] - INFO [main:Environment@100] - Client environment:java.version=1.8.0_181
2018-11-20 08:22:40,075 [myid:] - INFO [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2018-11-20 08:22:40,075 [myid:] - INFO [main:Environment@100] - Client environment:java.home=/usr/lib/jvm/java-8-openjdk-amd64/jre
2018-11-20 08:22:40,075 [myid:] - INFO [main:Environment@100] - Client environment:java.class.path=/home/lnfxcf/zookeeper-3.4.12/bin/../build/classes:/home/lnfxcf/zookeeper-3.4.12/bin/../build/lib/*.jar:/home/lnfxcf/zookeeper-3.4.12/bin/../lib/slf4j-log4j12-1.7.25.jar:/home/lnfxcf/zookeeper-3.4.12/bin/../lib/slf4j-api-1.7.25.jar:/home/lnfxcf/zookeeper-3.4.12/bin/../lib/netty-3.10.6.Final.jar:/home/lnfxcf/zookeeper-3.4.12/bin/../lib/log4j-1.2.17.jar:/home/lnfxcf/zookeeper-3.4.12/bin/../lib/jline-0.9.94.jar:/home/lnfxcf/zookeeper-3.4.12/bin/../lib/audience-annotations-0.5.0.jar:/home/lnfxcf/zookeeper-3.4.12/bin/../zookeeper-3.4.12.jar:/home/lnfxcf/zookeeper-3.4.12/bin/../src/java/lib/*.jar:/home/lnfxcf/zookeeper-3.4.12/bin/../conf:
2018-11-20 08:22:40,076 [myid:] - INFO [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
2018-11-20 08:22:40,078 [myid:] - INFO [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
2018-11-20 08:22:40,079 [myid:] - INFO [main:Environment@100] - Client environment:java.compiler=<NA>
2018-11-20 08:22:40,080 [myid:] - INFO [main:Environment@100] - Client environment:os.name=Linux
2018-11-20 08:22:40,081 [myid:] - INFO [main:Environment@100] - Client environment:os.arch=amd64
2018-11-20 08:22:40,081 [myid:] - INFO [main:Environment@100] - Client environment:os.version=4.15.0-39-generic
2018-11-20 08:22:40,082 [myid:] - INFO [main:Environment@100] - Client environment:user.name=lnfxcf
2018-11-20 08:22:40,082 [myid:] - INFO [main:Environment@100] - Client environment:user.home=/home/lnfxcf
2018-11-20 08:22:40,083 [myid:] - INFO [main:Environment@100] - Client environment:user.dir=/home/lnfxcf/zookeeper-3.4.12
2018-11-20 08:22:40,089 [myid:] - INFO [main:ZooKeeper@441] - Initiating client connection, connectString=ubuntu-zookeeper-01:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@255316f2
Welcome to ZooKeeper!
2018-11-20 08:22:40,132 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server ubuntu-zookeeper-01/192.168.42.130:2181. Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
2018-11-20 08:22:40,269 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@878] - Socket connection established to ubuntu-zookeeper-01/192.168.42.130:2181, initiating session
2018-11-20 08:22:40,283 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
[zk: ubuntu-zookeeper-01:2181(CONNECTING) 0] 2018-11-20 08:22:41,507 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server ubuntu-zookeeper-01/192.168.42.130:2181. Will not attempt to authenticate using SASL (unknown error)
2018-11-20 08:22:41,510 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@878] - Socket connection established to ubuntu-zookeeper-01/192.168.42.130:2181, initiating session
2018-11-20 08:22:41,512 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2018-11-20 08:22:43,106 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server ubuntu-zookeeper-01/192.168.42.130:2181. Will not attempt to authenticate using SASL (unknown error)
2018-11-20 08:22:43,107 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@878] - Socket connection established to ubuntu-zookeeper-01/192.168.42.130:2181, initiating session
2018-11-20 08:22:43,111 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2018-11-20 08:22:45,031 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server ubuntu-zookeeper-01/192.168.42.130:2181. Will not attempt to authenticate using SASL (unknown error)
2018-11-20 08:22:45,037 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@878] - Socket connection established to ubuntu-zookeeper-01/192.168.42.130:2181, initiating session
2018-11-20 08:22:45,040 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2018-11-20 08:22:46,523 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server ubuntu-zookeeper-01/192.168.42.130:2181. Will not attempt to authenticate using SASL (unknown error)
2018-11-20 08:22:46,529 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@878] - Socket connection established to ubuntu-zookeeper-01/192.168.42.130:2181, initiating session
2018-11-20 08:22:46,532 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2018-11-20 08:22:48,586 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server ubuntu-zookeeper-01/192.168.42.130:2181. Will not attempt to authenticate using SASL (unknown error)
2018-11-20 08:22:48,589 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@878] - Socket connection established to ubuntu-zookeeper-01/192.168.42.130:2181, initiating session
2018-11-20 08:22:48,596 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2018-11-20 08:22:50,424 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server ubuntu-zookeeper-01/192.168.42.130:2181. Will not attempt to authenticate using SASL (unknown error)
2018-11-20 08:22:50,425 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@878] - Socket connection established to ubuntu-zookeeper-01/192.168.42.130:2181, initiating session
2018-11-20 08:22:50,432 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-01:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
lnfxcf@lnfxcf:~/zookeeper-3.4.12$
lnfxcf@lnfxcf:~/zookeeper-3.4.12$ ./bin/zkCli.sh -server ubuntu-zookeeper-02:2181
Connecting to ubuntu-zookeeper-02:2181
2018-11-20 08:23:16,049 [myid:] - INFO [main:Environment@100] - Client environment:zookeeper.version=3.4.12-e5259e437540f349646870ea94dc2658c4e44b3b, built on 03/27/2018 03:55 GMT
2018-11-20 08:23:16,053 [myid:] - INFO [main:Environment@100] - Client environment:host.name=220.250.64.225
2018-11-20 08:23:16,053 [myid:] - INFO [main:Environment@100] - Client environment:java.version=1.8.0_181
2018-11-20 08:23:16,058 [myid:] - INFO [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2018-11-20 08:23:16,058 [myid:] - INFO [main:Environment@100] - Client environment:java.home=/usr/lib/jvm/java-8-openjdk-amd64/jre
2018-11-20 08:23:16,059 [myid:] - INFO [main:Environment@100] - Client environment:java.class.path=/home/lnfxcf/zookeeper-3.4.12/bin/../build/classes:/home/lnfxcf/zookeeper-3.4.12/bin/../build/lib/*.jar:/home/lnfxcf/zookeeper-3.4.12/bin/../lib/slf4j-log4j12-1.7.25.jar:/home/lnfxcf/zookeeper-3.4.12/bin/../lib/slf4j-api-1.7.25.jar:/home/lnfxcf/zookeeper-3.4.12/bin/../lib/netty-3.10.6.Final.jar:/home/lnfxcf/zookeeper-3.4.12/bin/../lib/log4j-1.2.17.jar:/home/lnfxcf/zookeeper-3.4.12/bin/../lib/jline-0.9.94.jar:/home/lnfxcf/zookeeper-3.4.12/bin/../lib/audience-annotations-0.5.0.jar:/home/lnfxcf/zookeeper-3.4.12/bin/../zookeeper-3.4.12.jar:/home/lnfxcf/zookeeper-3.4.12/bin/../src/java/lib/*.jar:/home/lnfxcf/zookeeper-3.4.12/bin/../conf:
2018-11-20 08:23:16,059 [myid:] - INFO [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
2018-11-20 08:23:16,060 [myid:] - INFO [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
2018-11-20 08:23:16,060 [myid:] - INFO [main:Environment@100] - Client environment:java.compiler=<NA>
2018-11-20 08:23:16,060 [myid:] - INFO [main:Environment@100] - Client environment:os.name=Linux
2018-11-20 08:23:16,061 [myid:] - INFO [main:Environment@100] - Client environment:os.arch=amd64
2018-11-20 08:23:16,061 [myid:] - INFO [main:Environment@100] - Client environment:os.version=4.15.0-39-generic
2018-11-20 08:23:16,061 [myid:] - INFO [main:Environment@100] - Client environment:user.name=lnfxcf
2018-11-20 08:23:16,062 [myid:] - INFO [main:Environment@100] - Client environment:user.home=/home/lnfxcf
2018-11-20 08:23:16,062 [myid:] - INFO [main:Environment@100] - Client environment:user.dir=/home/lnfxcf/zookeeper-3.4.12
2018-11-20 08:23:16,066 [myid:] - INFO [main:ZooKeeper@441] - Initiating client connection, connectString=ubuntu-zookeeper-02:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@255316f2
Welcome to ZooKeeper!
2018-11-20 08:23:16,100 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server ubuntu-zookeeper-02/192.168.42.132:2181. Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
2018-11-20 08:23:16,246 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@878] - Socket connection established to ubuntu-zookeeper-02/192.168.42.132:2181, initiating session
2018-11-20 08:23:16,269 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
[zk: ubuntu-zookeeper-02:2181(CONNECTING) 0] 2018-11-20 08:23:17,602 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server ubuntu-zookeeper-02/192.168.42.132:2181. Will not attempt to authenticate using SASL (unknown error)
2018-11-20 08:23:17,604 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@878] - Socket connection established to ubuntu-zookeeper-02/192.168.42.132:2181, initiating session
2018-11-20 08:23:17,607 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2018-11-20 08:23:18,997 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server ubuntu-zookeeper-02/192.168.42.132:2181. Will not attempt to authenticate using SASL (unknown error)
2018-11-20 08:23:18,999 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@878] - Socket connection established to ubuntu-zookeeper-02/192.168.42.132:2181, initiating session
2018-11-20 08:23:19,002 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2018-11-20 08:23:20,637 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server ubuntu-zookeeper-02/192.168.42.132:2181. Will not attempt to authenticate using SASL (unknown error)
2018-11-20 08:23:20,638 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@878] - Socket connection established to ubuntu-zookeeper-02/192.168.42.132:2181, initiating session
2018-11-20 08:23:20,639 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2018-11-20 08:23:22,040 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server ubuntu-zookeeper-02/192.168.42.132:2181. Will not attempt to authenticate using SASL (unknown error)
2018-11-20 08:23:22,043 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@878] - Socket connection established to ubuntu-zookeeper-02/192.168.42.132:2181, initiating session
2018-11-20 08:23:22,045 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2018-11-20 08:23:23,883 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server ubuntu-zookeeper-02/192.168.42.132:2181. Will not attempt to authenticate using SASL (unknown error)
2018-11-20 08:23:23,885 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@878] - Socket connection established to ubuntu-zookeeper-02/192.168.42.132:2181, initiating session
2018-11-20 08:23:23,890 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2018-11-20 08:23:25,210 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server ubuntu-zookeeper-02/192.168.42.132:2181. Will not attempt to authenticate using SASL (unknown error)
2018-11-20 08:23:25,213 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@878] - Socket connection established to ubuntu-zookeeper-02/192.168.42.132:2181, initiating session
2018-11-20 08:23:25,216 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2018-11-20 08:23:26,877 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server ubuntu-zookeeper-02/192.168.42.132:2181. Will not attempt to authenticate using SASL (unknown error)
2018-11-20 08:23:26,879 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@878] - Socket connection established to ubuntu-zookeeper-02/192.168.42.132:2181, initiating session
2018-11-20 08:23:26,881 [myid:] - INFO [main-SendThread(ubuntu-zookeeper-02:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect