1. 程式人生 > >Ubuntu 啟動zookeeper報錯

Ubuntu 啟動zookeeper報錯

type timeout ora main syn 9.1 local src api

在啟動zk客戶端連接server時報錯:

2019-03-30 23:06:24,915 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1235] - Socket error occurred: localhost/127.0.0.1:2181: Connection refused
2019-03-30 23:06:26,017 [myid:localhost:2181] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1106] - Opening socket connection to server localhost/127.0.0.1:2181. Will not
attempt to authenticate using SASL (unknown error) 2019-03-30 23:06:26,019 [myid:localhost:2181] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1235] - Socket error occurred: localhost/127.0.0.1:2181: Connection refused

原因是zkServer未正常啟動,為確保啟動正常,切換用戶到root下進行啟動:

# zkServer.sh start
ZooKeeper JMX enabled by default
Using config: 
/home/fujiangwei/kinson/zk/bin/../conf/zoo.cfg Starting zookeeper ... STARTED

查看啟動狀態:

# zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /home/fujiangwei/kinson/zk/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: standalone

重新連接server:

$ zkCli.sh -server localhost:2181
Connecting to localhost:2181 2019-03-30 23:11:04,093 [myid:] - INFO [main:Environment@109] - Client environment:zookeeper.version=3.5.4-beta-7f51e5b68cf2f80176ff944a9ebd2abbc65e7327, built on 05/11/2018 16:27 GMT 2019-03-30 23:11:04,106 [myid:] - INFO [main:Environment@109] - Client environment:host.name=ubuntu 2019-03-30 23:11:04,106 [myid:] - INFO [main:Environment@109] - Client environment:java.version=1.8.0_201 2019-03-30 23:11:04,114 [myid:] - INFO [main:Environment@109] - Client environment:java.vendor=Oracle Corporation 2019-03-30 23:11:04,115 [myid:] - INFO [main:Environment@109] - Client environment:java.home=/home/fujiangwei/kinson/jdk1.8.0_201/jre 2019-03-30 23:11:04,116 [myid:] - INFO [main:Environment@109] - Client environment:java.class.path=/home/fujiangwei/kinson/zk/bin/../build/classes:/home/fujiangwei/kinson/zk/bin/../build/lib/*.jar:/home/fujiangwei/kinson/zk/bin/../lib/slf4j-log4j12-1.7.25.jar:/home/fujiangwei/kinson/zk/bin/../lib/slf4j-api-1.7.25.jar:/home/fujiangwei/kinson/zk/bin/../lib/netty-3.10.6.Final.jar:/home/fujiangwei/kinson/zk/bin/../lib/log4j-1.2.17.jar:/home/fujiangwei/kinson/zk/bin/../lib/jline-2.11.jar:/home/fujiangwei/kinson/zk/bin/../lib/jetty-util-9.2.18.v20160721.jar:/home/fujiangwei/kinson/zk/bin/../lib/jetty-servlet-9.2.18.v20160721.jar:/home/fujiangwei/kinson/zk/bin/../lib/jetty-server-9.2.18.v20160721.jar:/home/fujiangwei/kinson/zk/bin/../lib/jetty-security-9.2.18.v20160721.jar:/home/fujiangwei/kinson/zk/bin/../lib/jetty-io-9.2.18.v20160721.jar:/home/fujiangwei/kinson/zk/bin/../lib/jetty-http-9.2.18.v20160721.jar:/home/fujiangwei/kinson/zk/bin/../lib/javax.servlet-api-3.1.0.jar:/home/fujiangwei/kinson/zk/bin/../lib/jackson-mapper-asl-1.9.11.jar:/home/fujiangwei/kinson/zk/bin/../lib/jackson-core-asl-1.9.11.jar:/home/fujiangwei/kinson/zk/bin/../lib/commons-cli-1.2.jar:/home/fujiangwei/kinson/zk/bin/../lib/audience-annotations-0.5.0.jar:/home/fujiangwei/kinson/zk/bin/../zookeeper-3.5.4-beta.jar:/home/fujiangwei/kinson/zk/bin/../src/java/lib/*.jar:/home/fujiangwei/kinson/zk/bin/../conf:.:/home/fujiangwei/kinson/jdk1.8.0_201/lib:/home/fujiangwei/kinson/jdk1.8.0_201/jre/lib: 2019-03-30 23:11:04,117 [myid:] - INFO [main:Environment@109] - Client environment:java.library.path=/usr/java/packages/lib/i386:/lib:/usr/lib 2019-03-30 23:11:04,122 [myid:] - INFO [main:Environment@109] - Client environment:java.io.tmpdir=/tmp 2019-03-30 23:11:04,124 [myid:] - INFO [main:Environment@109] - Client environment:java.compiler=<NA> 2019-03-30 23:11:04,124 [myid:] - INFO [main:Environment@109] - Client environment:os.name=Linux 2019-03-30 23:11:04,125 [myid:] - INFO [main:Environment@109] - Client environment:os.arch=i386 2019-03-30 23:11:04,127 [myid:] - INFO [main:Environment@109] - Client environment:os.version=3.11.0-15-generic 2019-03-30 23:11:04,129 [myid:] - INFO [main:Environment@109] - Client environment:user.name=fujiangwei 2019-03-30 23:11:04,129 [myid:] - INFO [main:Environment@109] - Client environment:user.home=/home/fujiangwei 2019-03-30 23:11:04,130 [myid:] - INFO [main:Environment@109] - Client environment:user.dir=/home/fujiangwei 2019-03-30 23:11:04,130 [myid:] - INFO [main:Environment@109] - Client environment:os.memory.free=11MB 2019-03-30 23:11:04,136 [myid:] - INFO [main:Environment@109] - Client environment:os.memory.max=247MB 2019-03-30 23:11:04,136 [myid:] - INFO [main:Environment@109] - Client environment:os.memory.total=15MB 2019-03-30 23:11:04,150 [myid:] - INFO [main:ZooKeeper@868] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@1eb6432 2019-03-30 23:11:04,174 [myid:] - INFO [main:ClientCnxnSocket@236] - jute.maxbuffer value is 4194304 Bytes Welcome to ZooKeeper! 2019-03-30 23:11:04,231 [myid:localhost:2181] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1106] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) JLine support is enabled 2019-03-30 23:11:04,383 [myid:localhost:2181] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@947] - Socket connection established, initiating session, client: /127.0.0.1:35373, server: localhost/127.0.0.1:2181 2019-03-30 23:11:04,467 [myid:localhost:2181] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1381] - Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x10004e6659b0000, negotiated timeout = 30000 [zk: localhost:2181(CONNECTING) 0] WATCHER:: WatchedEvent state:SyncConnected type:None path:null

連接正常。

Ubuntu 啟動zookeeper報錯