[root@rpp bin]# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config:/usr/local/apache-zookeeper-3.6.1/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
启动zookeeper客户端
[root@rpp bin]# ./zkCli.sh
启动成功效果如下
2020-07-2620:12:24,919[myid:]- INFO [main:Environment@98]- Client environment:zookeeper.version=3.6.1--104dcb3e3fb464b30c5186d229e00af9f332524b, built on 04/21/202015:01 GMT
2020-07-2620:12:24,922[myid:]- INFO [main:Environment@98]- Client environment:host.name=rpp
2020-07-2620:12:24,922[myid:]- INFO [main:Environment@98]- Client environment:java.version=1.8.0_101
2020-07-2620:12:24,923[myid:]- INFO [main:Environment@98]- Client environment:java.vendor=Oracle Corporation
2020-07-2620:12:24,923[myid:]- INFO [main:Environment@98]- Client environment:java.home=/usr/local/jdk1.8.0_101/jre
2020-07-2620:12:24,923[myid:]- INFO [main:Environment@98]- Client environment:java.class.path=/usr/local/apache-zookeeper-3.6.1/bin/../zookeeper-server/target/classes:/usr/local/apache-zookeeper-3.6.1/bin/../build/classes:/usr/local/apache-zookeeper-3.6.1/bin/../
......中间过程省略
2020-07-2620:12:24,924[myid:]- INFO [main:Environment@98]- Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2020-07-2620:12:24,924[myid:]- INFO [main:Environment@98]- Client environment:java.io.tmpdir=/tmp
2020-07-2620:12:24,924[myid:]- INFO [main:Environment@98]- Client environment:java.compiler=<NA>2020-07-2620:12:24,924[myid:]- INFO [main:Environment@98]- Client environment:os.name=Linux
2020-07-2620:12:24,924[myid:]- INFO [main:Environment@98]- Client environment:os.arch=amd64
2020-07-2620:12:24,924[myid:]- INFO [main:Environment@98]- Client environment:os.version=3.10.0-957.21.3.el7.x86_64
2020-07-2620:12:24,924[myid:]- INFO [main:Environment@98]- Client environment:user.name=root
2020-07-2620:12:24,924[myid:]- INFO [main:Environment@98]- Client environment:user.home=/root
2020-07-2620:12:24,924[myid:]- INFO [main:Environment@98]- Client environment:user.dir=/usr/local/apache-zookeeper-3.6.1/bin
2020-07-2620:12:24,924[myid:]- INFO [main:Environment@98]- Client environment:os.memory.free=50MB
2020-07-2620:12:24,925[myid:]- INFO [main:Environment@98]- Client environment:os.memory.max=228MB
2020-07-2620:12:24,925[myid:]- INFO [main:Environment@98]- Client environment:os.memory.total=56MB
2020-07-2620:12:24,929[myid:]- INFO [main:ZooKeeper@1005]- Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@762efe5d2020-07-2620:12:24,932[myid:]- INFO [main:X509Util@77]- Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation
2020-07-2620:12:24,937[myid:]- INFO [main:ClientCnxnSocket@239]- jute.maxbuffer value is 1048575 Bytes
2020-07-2620:12:24,943[myid:]- INFO [main:ClientCnxn@1703]- zookeeper.request.timeout value is 0. feature enabled=false
Welcome to ZooKeeper!
JLine support is enabled
2020-07-2620:12:24,964[myid:localhost:2181]- INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1154]- Opening socket connection to server localhost/127.0.0.1:2181.2020-07-2620:12:24,964[myid:localhost:2181]- INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1156]- SASL config status: Will not attempt to authenticate using SASL (unknown error)2020-07-2620:12:25,011[myid:localhost:2181]- INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@986]- Socket connection established, initiating session, client:/127.0.0.1:53610, server: localhost/127.0.0.1:21812020-07-2620:12:25,039[myid:localhost:2181]- INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1420]- Session establishment complete on server localhost/127.0.0.1:2181, session id =0x105b34ea78c0000, negotiated timeout =30000
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
如果是连接多个不同的主机节点,可以使用如下命令:
[root@rpp bin]# ./zkCli.sh -server ipxxx:2888
查看服务端状态:
[root@rpp bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config:/usr/local/apache-zookeeper-3.6.1/bin/../conf/zoo.cfg
Client port found:2181. Client address: localhost.
Mode: standalone