CentOS_7中的zookeeper安装

下载zookeeper

wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.5.8/apache-zookeeper-3.5.8.tar.gz

解压

tar -zxvf apache-zookeeper-3.5.8.tar.gz

修改zookeeper配置

cd /usr/local/apache-zookeeper-3.5.8/conf
cp zoo_sample.cfg zoo.cfg
# 自己装vim 没有用vi
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 # Follow服务器从与Leader服务器第一次数据同步之间最大心跳数
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5 # Follow服务器从与Leader服务器通信之间最大心跳数
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/usr/local/apache-zookeeper-3.5.8/data # 数据文件目录
dataLogDir=/usr/local/apache-zookeeper-3.5.8/logs # 日志文件目录
# the port at which the clients will connect
clientPort=2181 # 监听端口 默认2181

使用maven打包zookeeper-server

cd /usr/local/apache-zookeeper-3.5.8/zookeeper-server

mvn package -Dmaven.test.skip=true

启动zookeeper

./bin/zkServer.sh start

 

原文地址:https://www.cnblogs.com/chao666/p/13321119.html