現象:
2019-12-30 23:19:42,571 [myid:] - INFO [main:[email protected]] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 [email protected]
ZooKeeper -server host:port cmd args
stat path [watch]
set path data [version]
ls path [watch]
delquota [-n|-b] path
排查問題:
[[email protected] bin]# zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/software/zookeeper-3.4.12/bin/../conf/zoo.cfg
Mode: follower
确定目前zookeeper已經啟動
檢視配置:
[[email protected] bin]# cat ../conf/zoo.cfg
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/usr/local/software/zookeeper-3.4.12/data
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
server.0=192.168.25.128:2888:3888
server.1=192.168.25.129:2888:3888
server.2=192.168.25.130:2888:3888
server.3=192.168.25.131:2888:3888
配置的沒有問題
重新嘗試zkCli.sh -server 192.168.25.131:2181 連接配接成功
不直接使用
[[email protected] bin]# zkCli.sh -server localhost:2181
Connecting to localhost:2181
2019-12-30 23:24:58,007 [myid:] - INFO [main:[email protected]] - Client environment:zookeeper.version=3.4.12-e5259e437540f349646870ea94dc2658c4e44b3b, built on 03/27/2018 03:55 GMT
2019-12-30 23:24:58,023 [myid:] - INFO [main:[email protected]] - Client environment:host.name=bogon
2019-12-30 23:24:58,024 [myid:] - INFO [main:[email protected]] - Client environment:java.version=1.8.0_201
2019-12-30 23:24:58,034 [myid:] - INFO [main:[email protected]] - Client environment:java.vendor=Oracle Corporation
2019-12-30 23:24:58,034 [myid:] - INFO [main:[email protected]] - Client environment:java.home=/usr/local/software/jdk1.8.0_201/jre
2019-12-30 23:24:58,035 [myid:] - INFO [main:[email protected]] - Client environment:java.class.path=/usr/local/software/zookeeper-3.4.12/bin/../build/classes:/usr/local/software/zookeeper-3.4.12/bin/../build/lib/*.jar:/usr/local/software/zookeeper-3.4.12/bin/../lib/slf4j-log4j12-1.7.25.jar:/usr/local/software/zookeeper-3.4.12/bin/../lib/slf4j-api-1.7.25.jar:/usr/local/software/zookeeper-3.4.12/bin/../lib/netty-3.10.6.Final.jar:/usr/local/software/zookeeper-3.4.12/bin/../lib/log4j-1.2.17.jar:/usr/local/software/zookeeper-3.4.12/bin/../lib/jline-0.9.94.jar:/usr/local/software/zookeeper-3.4.12/bin/../lib/audience-annotations-0.5.0.jar:/usr/local/software/zookeeper-3.4.12/bin/../zookeeper-3.4.12.jar:/usr/local/software/zookeeper-3.4.12/bin/../src/java/lib/*.jar:/usr/local/software/zookeeper-3.4.12/bin/../conf:.:/usr/local/software/jdk1.8.0_201/lib/dt.jar:/usr/local/software/jdk1.8.0_201/lib/tools.jar
2019-12-30 23:24:58,035 [myid:] - INFO [main:[email protected]] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2019-12-30 23:24:58,035 [myid:] - INFO [main:[email protected]] - Client environment:java.io.tmpdir=/tmp
2019-12-30 23:24:58,035 [myid:] - INFO [main:[email protected]] - Client environment:java.compiler=<NA>
2019-12-30 23:24:58,035 [myid:] - INFO [main:[email protected]] - Client environment:os.name=Linux
2019-12-30 23:24:58,036 [myid:] - INFO [main:[email protected]] - Client environment:os.arch=amd64
2019-12-30 23:24:58,036 [myid:] - INFO [main:[email protected]] - Client environment:os.version=3.10.0-862.el7.x86_64
2019-12-30 23:24:58,036 [myid:] - INFO [main:[email protected]] - Client environment:user.name=root
2019-12-30 23:24:58,037 [myid:] - INFO [main:[email protected]] - Client environment:user.home=/root
2019-12-30 23:24:58,037 [myid:] - INFO [main:[email protected]] - Client environment:user.dir=/usr/local/software/zookeeper-3.4.12/bin
2019-12-30 23:24:58,039 [myid:] - INFO [main:[email protected]] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 [email protected]
Welcome to ZooKeeper!
2019-12-30 23:24:58,077 [myid:] - INFO [main-SendThread(localhost:2181):[email protected]] - 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-12-30 23:24:58,161 [myid:] - INFO [main-SendThread(localhost:2181):[email protected]] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2019-12-30 23:24:58,177 [myid:] - INFO [main-SendThread(localhost:2181):[email protected]] - Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x3123ba00002, negotiated timeout = 30000
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
成功啟動