詹学伟
詹学伟
Published on 2024-04-21 / 13 Visits
0
0

zookeeper分布式安装

说明:在安装zookeeper前,请安装好jdk

1、下载

连接地址:https://archive.apache.org/dist/zookeeper/zookeeper-3.4.12/zookeeper-3.4.12.tar.gz

2、解压

tar -zvxf zookeeper-3.4.12.tar.gz

3、重命名和移动

mv zookeeper-3.4.12 /usr/local/

4、配置文件修改

cd /usr/local/zookeeper-3.4.12/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.
dataDir=/usr/local/zookeeper-3.4.12/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.
#
# 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
server.3=node3:2888:3888
server.4=node4:2888:3888
server.5=node5:2888:3888

5、环境变量修改

vim /etc/profile
#zookeeper
export ZOOKEEPER_HOME=/usr/local/zookeeper-3.4.12
export PATH=$PATH:$ZOOKEEPER_HOME/bin
cd /usr/local/zookeeper-3.4.12/data

vim myid

1

6、分发到各个节点

注意:分发后,各个节点的myid必须修改且唯一


Comment