1. 首先解压
tar -zxf apache-zookeeper-3.6.0-bin.tar.gz
2. 修改conf目录
cp zoo_sample.cfg zoo.cfg
vim 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.
# 存储快照的目录。不要使用/tmp存储,/tmp这里只是示例sakes。
dataDir=/root/zk3.6/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.
# 在打开autopurge之前,请务必阅读管理员指南的维护部分。
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
# 要在dataDir中保留的快照数
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
# 清除任务间隔(以小时为单位)设置为“0”以禁用自动清除功能
#autopurge.purgeInterval=1
## Metrics Providers 度量提供者
#
# https://prometheus.io Metrics Exporter 度量导出器
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true
3. 切换到bin目录启动
./zkServer.sh start
./zkServer.sh status