http://apache.fayea.com/zookeeper/
[Email protected]:/usr/local/zookeeper-3.4.9# vim/etc/profile
#Zookeeper Home
Export zookeeper_home=/usr/local/zookeeper-3.4.9
Export path= $PATH: $ZOOKEEPER _home/bin
[Email protected]:/usr/local/zookeeper-3.4.9# MKIDR Data
[Email protected]:/usr/local/zookeeper-3.4.9# MKIDR Logs
[Email protected]:/usr/local/zookeeper-3.4.9# vim Data/myid
1
[Email protected]:/usr/local/zookeeper-3.4.9# cp conf/zoo_sample.cfg CONF/ZOO.CFG
[Email protected]:/usr/local/zookeeper-3.4.9# vim conf/zoo.cfg
Datadir=/usr/local/zookeeper-3.4.9/data
Datalogdir=/usr/local/zookeeper-3.4.9/logs
# The port at which the clients would connect
clientport=2181
server.1=192.168.117.34:2888:3888
server.2=192.168.117.40:2888:3888
server.3=192.168.117.38:2888:3888
Then copy the configuration file to the other 2 nodes
[Email protected]:/usr/local/zookeeper-3.4.9# zkserver.sh Start
ZooKeeper JMX enabled by default
Using config:/usr/local/zookeeper-3.4.9/bin/. /conf/zoo.cfg
Starting zookeeper ... STARTED
[Email protected]:/usr/local/zookeeper-3.4.9# zkserver.sh Status
ZooKeeper JMX enabled by default
Using config:/usr/local/zookeeper-3.4.9/bin/. /conf/zoo.cfg
Mode:follower
[Email protected]:/usr/local/zookeeper-3.4.9# NETSTAT-ANTLP | grep 2181
TCP 0 0 127.0.0.1:38052 127.0.0.1:2181 time_wait-
TCP6 0 0::: 2181:::* LISTEN 31064/java
[Email protected]:/usr/local/zookeeper-3.4.9# zkserver.sh Start
ZooKeeper JMX enabled by default
Using config:/usr/local/zookeeper-3.4.9/bin/. /conf/zoo.cfg
Starting zookeeper ... STARTED
[Email protected]:/usr/local/zookeeper-3.4.9# zkserver.sh Status
ZooKeeper JMX enabled by default
Using config:/usr/local/zookeeper-3.4.9/bin/. /conf/zoo.cfg
Mode:leader
[Email protected]:/usr/local/zookeeper-3.4.9# zkserver.sh Start
ZooKeeper JMX enabled by default
Using config:/usr/local/zookeeper-3.4.9/bin/. /conf/zoo.cfg
Starting zookeeper ... STARTED
[Email protected]:/usr/local/zookeeper-3.4.9# zkserver.sh Status
ZooKeeper JMX enabled by default
Using config:/usr/local/zookeeper-3.4.9/bin/. /conf/zoo.cfg
Mode:follower
Connecting zookeeper clusters
[Email protected]:/usr/local/zookeeper-3.4.9# zkcli.sh-server Node1
Connecting to Node1
2017-07-31 16:54:31,066 [myID:]-INFO [main:[email protected]]-Client environment:zookeeper.version=3.4.9-1757313, BU Ilt on 08/23/2016 06:50 GMT
2017-07-31 16:54:31,068 [myID:]-INFO [main:[email protected]]-Client environment:host.name=node1
2017-07-31 16:54:31,068 [myID:]-INFO [main:[email protected]]-Client environment:java.version=1.8.0_131
2017-07-31 16:54:31,069 [myID:]-INFO [main:[email protected]]-Client environment:java.vendor=oracle Corporation
2017-07-31 16:54:31,070 [myID:]-INFO [main:[email protected]]-Client environment:java.home=/usr/lib/jvm/ Java-8-openjdk-amd64/jre
2017-07-31 16:54:31,070 [myID:]-info [main:[email protected]]-Client Environment: java.class.path=/usr/local/zookeeper-3.4.9/bin/. /build/classes:/usr/local/zookeeper-3.4.9/bin/. /build/lib/*.jar:/usr/local/zookeeper-3.4.9/bin/. /lib/slf4j-log4j12-1.6.1.jar:/usr/local/zookeeper-3.4.9/bin/. /lib/slf4j-api-1.6.1.jar:/usr/local/zookeeper-3.4.9/bin/. /lib/netty-3.10.5.final.jar:/usr/local/zookeeper-3.4.9/bin/. /lib/log4j-1.2.16.jar:/usr/local/zookeeper-3.4.9/bin/. /lib/jline-0.9.94.jar:/usr/local/zookeeper-3.4.9/bin/. /zookeeper-3.4.9.jar:/usr/local/zookeeper-3.4.9/bin/. /src/java/lib/*.jar:/usr/local/zookeeper-3.4.9/bin/. /conf:.:/ Usr/lib/jvm/java-8-openjdk-amd64/lib://usr/lib/jvm/java-8-openjdk-amd64/jre/lib
2017-07-31 16:54:31,070 [myID:]-INFO [main:[email protected]]-Client environment:java.library.path=/usr/local/ Cuda-8.0/lib64:/usr/local/cuda-8.0/lib64::/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
2017-07-31 16:54:31,070 [myID:]-INFO [main:[email protected]]-Client environment:java.io.tmpdir=/tmp
2017-07-31 16:54:31,070 [myID:]-INFO [main:[email protected]]-Client environment:java.compiler=<na>
2017-07-31 16:54:31,070 [myID:]-INFO [main:[email protected]]-Client environment:os.name=linux
2017-07-31 16:54:31,070 [myID:]-INFO [main:[email protected]]-Client ENVIRONMENT:OS.ARCH=AMD64
2017-07-31 16:54:31,070 [myID:]-INFO [main:[email protected]]-Client environment:os.version=4.8.0-36-generic
2017-07-31 16:54:31,070 [myID:]-INFO [main:[email protected]]-Client environment:user.name=root
2017-07-31 16:54:31,070 [myID:]-INFO [main:[email protected]]-Client environment:user.home=/root
2017-07-31 16:54:31,070 [myID:]-INFO [main:[email protected]]-Client environment:user.dir=/usr/local/ zookeeper-3.4.9
2017-07-31 16:54:31,071 [myID:]-INFO [main:[email protected]]-initiating client connection, Connectstring=node1 Sessi ontimeout=30000 [email protected]
Welcome to zookeeper!
2017-07-31 16:54:31,084 [myID:]-INFO [Main-sendthread (node1:2181): [email protected]]-Opening socket connection to Ser Ver node1/192.168.117.34:2181. Won't attempt to authenticate using SASL (unknown error)
JLine support is enabled
2017-07-31 16:54:31,123 [myID:]-INFO [Main-sendthread (node1:2181): [email protected]]-Socket connection established to node1/192.168.117.34:2181, initiating session
[Zk:node1 (connecting) 0] 2017-07-31 16:54:31,196 [myID:]-INFO [Main-sendthread (node1:2181): [email protected]]-Sessio n Establishment complete on server node1/192.168.117.34:2181, SessionID = 0x15d97c546110000, negotiated timeout = 30000
Watcher::
Watchedevent state:syncconnected Type:none Path:null
[Zk:node1 (CONNECTED) 0]
This article is from the "Technical Achievement Dream" blog, please be sure to keep this source http://andyliu.blog.51cto.com/518879/1967311
Ubuntu16.04 Installing the Zookeeper cluster