ZooKeeper单机模式入门

一、下载ZooKeeper

http://zookeeper.apache.org/doc/trunk/zookeeperStarted.html#sc_Download

二、单机模式使用Zookeeper

1.解压ZooKeepertar包;

2.在解压后的目录里,创建conf/zoo.cfg,设置好关键配置

tickTime

thebasictimeunitinmillisecondsusedbyZooKeeper.ItisusedtodoheartbeatsandtheminimumsessiontimeoutwillbetwicethetickTime.

dataDir

thelocationtostorethein-memorydatabasesnapshotsand,unlessspecifiedotherwise,thetransactionlogofupdatestothedatabase.

clientPort

theporttolistenforclientconnections

3.启动ZooKeeperServer

bin/zkServer.shstart

4.客户端连接ZooKeeperServer

bin/zkCli.sh-server127.0.0.1:2181

接着通过help查看可用的操作命令;

相关推荐