部署zookeeper集群

zookeeper和jdk下载地址

jdk

链接:https://pan.baidu.com/s/13GpNaAiHM5HSDJ66ebBtEg

提取码:90se

zookeeper

链接:https://pan.baidu.com/s/1nSFKEhSGNiwgSPZWdb7hkw

提取码:u5l2

在所有的机器上面执行下面步骤:

1.上传zookeeper和jdk, /opt/soft/

2.解压jdk和zookeeper

tar xf xxxx

3.配置jdk环境变量:

vi /etc/profile

export JAVA_HOME=/opt/soft/jdk/jdk1.8.0_181

export PATH=JAVA_HOME/bin/:PATH

然后source /etc/profile

java -version看能否打印正确信息

4.配置zookeeper, /conf/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=/opt/soft/zookeeper-3.4.13/data
dataLogDir=/opt/soft/zookeeper-3.4.13/datalog

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.1=10.192.126.144:2888:3888
server.2=10.192.126.145:2888:3888
server.3=10.192.126.146:2888:3888
server.4=10.192.126.147:2888:3888
server.5=10.192.126.148:2888:3888

5.创建目录

mkdir -p /opt/soft/zookeeper-3.4.13/data

mkdir -p /opt/soft/zookeeper-3.4.13/datalog

执行下面步骤 数字是和上面标红配置一致。

例如10.192.126.144机器执行 echo 1 > /opt/soft/zookeeper-3.4.13/data/myid

例如10.192.126.145机器执行 echo 2 > /opt/soft/zookeeper-3.4.13/data/myid

后边类似。

echo 3 > /opt/soft/zookeeper-3.4.13/data/myid

echo 4 > /opt/soft/zookeeper-3.4.13/data/myid

echo 5 > /opt/soft/zookeeper-3.4.13/data/myid

综上,整体配置已经完成,直接到 bin/zkServer.sh start 就行了。

bin/zkServer.sh status查看状态。

如果zookeeper用systemctl管理,查看另一篇文章:

systemctl管理kafka和zookeeper_早退的程序员的博客-CSDN博客

相关推荐
木风小助理1 小时前
PostgreSQL 的范式跃迁:从关系型数据库到统一数据平台
服务器·云原生·kubernetes
阿里云云原生1 小时前
ECS 端口不通,丢包诊断看这里!阿里云 SysOM 智能诊断实战!
云原生
ZePingPingZe1 小时前
秒杀-库存超卖&流量削峰
java·分布式
阿里云云原生3 小时前
从这张年度技术力量榜单里,看见阿里云从云原生到 AI 原生的进化能力和决心
云原生
Wang's Blog3 小时前
Kafka: HTTPS证书申请集成指南
分布式·https·kafka
阿里云云原生3 小时前
2025 智能体工程现状
云原生·llm
是一个Bug4 小时前
云原生架构
云原生·架构
富士康质检员张全蛋5 小时前
深入理解zookeeper session机制
zookeeper
Wang's Blog6 小时前
Kafka: 消费者高级实践之分区控制、多线程处理与 Offset 管理
分布式·kafka
老鱼说AI6 小时前
经典论文精读第一期:DeepSeek-R1-Zero ——RL奇迹
人工智能·分布式·深度学习·神经网络·自然语言处理·nlp·transformer