zookeeper下载地址 跳转下载
故事: 电脑进了可乐,暂时换了新的电脑在使用,使用 brew 安装 Zookeeper,发现代码启动链接不上zookeeper,查看zk版本是3.5.x的版本,以为不兼容,于是手动下载了 3.4.14版本的zk进行安装,还是出现事故, 使用 zkServer.sh status 发现zk没有跑起来,于是查看 zkServer.sh 里边是啥,发现启动命令也是普通的JAVA命令进行启动,查看.bash_profile,发现是JAVA_HOME配置版本错误了,事故原因找到快速修复即可使用.
安装
- 下载zk包,解压,进入conf目录,vim zoo.cfg
- 设置data目录
zoo.cfg目录如下
# The number of milliseconds of each tick
# 用于计算的时间单元,下面的其它时间都是以这个tick为单位的
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
# 10个tick时间。用于集群,允许从节点连接并同步到master节点的初始化连接时间
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.
# 数据存储的目录,必须配置
# 还有 daraLogDir, 日志目录,如果不配,和 dataDir 共用
dataDir=/Users/jiangwang/Documents/zookeeper-3.4.14/data
# the port at which the clients will connect
# 连接服务器的端口,默认2181。如果是伪分布式,即在单台部署多个zookeeper节点,那么可以改这个端口实现
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
- zkServer.sh start 启动