Zookeeper安装

在本地window 64环境下进行的安装,zk官网,下载的是3.4.14。解压并切换到conf目录,修改zoo_sample.cfg修改为zoo.cfg,zoo.cfg中相关参数说明:

# zk里使用的基本时间单位
#tickTime=2000
# leader和follower之间最长的心跳时间,心跳时间为initLimit*tickTime,
#如果为10,则这里的心跳时间为10 * 2000=20000ms=20s
#initLimit=10
# leader和follower之间发送消息,请求和应答的最大时间长度,时间长度为syncLimit*tickTime,
#如果为5,则这里的时间长度为5*2000=10000ms=10s
#syncLimit=5
# zk数据目录
#dataDir=/zookeeper_data
# 端口
#clientPort=2181
# 客户端连接上限,可增加
#maxClientCnxns=60

进入D:zookeeper-3.4.14bin,双击zkServer.cmd

2019-04-23 17:44:08,580 [myid:] - INFO  [main:Environment@100] - Server environm
ent:java.compiler=
2019-04-23 17:44:08,581 [myid:] - INFO  [main:Environment@100] - Server environm
ent:os.name=Windows 7
2019-04-23 17:44:08,582 [myid:] - INFO  [main:Environment@100] - Server environm
ent:os.arch=amd64
2019-04-23 17:44:08,582 [myid:] - INFO  [main:Environment@100] - Server environm
ent:os.version=6.1
2019-04-23 17:44:08,587 [myid:] - INFO  [main:Environment@100] - Server environm
ent:user.name=weilu
2019-04-23 17:44:08,588 [myid:] - INFO  [main:Environment@100] - Server environm
ent:user.home=C:\Users\weilu
2019-04-23 17:44:08,589 [myid:] - INFO  [main:Environment@100] - Server environm
ent:user.dir=D:\zookeeper-3.4.14\bin
2019-04-23 17:44:08,596 [myid:] - INFO  [main:ZooKeeperServer@836] - tickTime se
t to 2000
2019-04-23 17:44:08,596 [myid:] - INFO  [main:ZooKeeperServer@845] - minSessionT
imeout set to -1
2019-04-23 17:44:08,597 [myid:] - INFO  [main:ZooKeeperServer@854] - maxSessionT
imeout set to -1
2019-04-23 17:44:08,690 [myid:] - INFO  [main:ServerCnxnFactory@117] - Using org
.apache.zookeeper.server.NIOServerCnxnFactory as server connection factory
2019-04-23 17:44:08,693 [myid:] - INFO  [main:NIOServerCnxnFactory@89] - binding
 to port 0.0.0.0/0.0.0.0:2181

开一个command,进入到安装zk的bin目录下,执行:
zkCli.cmd -server localhost:2181
部分输出:

2019-04-23 18:02:21,476 [myid:] - INFO  [main:Environment@100] - Client environm
ent:user.name=weilu
2019-04-23 18:02:21,476 [myid:] - INFO  [main:Environment@100] - Client environm
ent:user.home=C:\Users\weilu
2019-04-23 18:02:21,476 [myid:] - INFO  [main:Environment@100] - Client environm
ent:user.dir=D:\zookeeper-3.4.14\bin
2019-04-23 18:02:21,478 [myid:] - INFO  [main:ZooKeeper@442] - Initiating client
 connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apach
e.zookeeper.ZooKeeperMain$MyWatcher@531d72ca
Welcome to ZooKeeper!
JLine support is enabled
2019-04-23 18:02:21,593 [myid:] - INFO  [main-SendThread(localhost:2181):ClientC
nxn$SendThread@1025] - Opening socket connection to server localhost/0:0:0:0:0:0
:0:1:2181. Will not attempt to authenticate using SASL (unknown error)
2019-04-23 18:02:21,595 [myid:] - INFO  [main-SendThread(localhost:2181):ClientC
nxn$SendThread@879] - Socket connection established to localhost/0:0:0:0:0:0:0:1
:2181, initiating session
[zk: localhost:2181(CONNECTING) 0] 2019-04-23 18:02:21,976 [myid:] - INFO  [main
-SendThread(localhost:2181):ClientCnxn$SendThread@1299] - Session establishment
complete on server localhost/0:0:0:0:0:0:0:1:2181, sessionid = 0x1005e8c0f390000
, negotiated timeout = 30000

WATCHER::

WatchedEvent state:SyncConnected type:None path:null

客户端已成功连上server !

你可能感兴趣的:(zookeeper)