1. 程式人生 > 實用技巧 >CentOS_7中的zookeeper安裝

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