单机模式安装Zookeeper服务方法

单机模式安装Zookeeper服务方法

1、解压到自己任意磁盘下,我的位置是D:\zookeeper-3.4.6

2、复制zoo_sample.cfg 重命名为zoo.cfg。

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=D:\\data\\zookeeper
# log config
dataLogDir=D:\\log\\zookeeper
# 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

其中属性释义如下:

dataDir为zookeeper数据存放位置,zookeeper将数据文件保存在这里;

dataLogDir是日志文件,zookeeper将日志文件保存在这里;

clientPort=2181是zookeeper端口,我们连接zookeeper的端口,zookeeper会监听这个端口,接收客户端访问请求。

tickTime:zookeeper服务器之间,或者zookeeper客户端与服务器之间维持的心跳的时间间隔,每隔tickTime时间,会执行一次。(心跳证明活着,心跳时间就是超时设置时间,可以理解为客户端和服务器端的session)

3 、转到D盘的zookeeper bin目录下,执行zkServer.cmd,这样就启动了zookeeper服务了。

4、查看zookeeper运行情况:D:\zookeeper-3.4.6\bin>zkCli.cmd-server 127.0.0.1:2181。

这样就完成了zookeeper windows单机模式安装。

猜你喜欢

转载自blog.csdn.net/sheinenggaosuwo/article/details/86582138