2.zookeeper3.8.4安装

1.服务器规划

zookeeper 版本3.8.4

2.预先准备

2.1.ssh免密登录

bash 复制代码
ssh-keygen -t rsa

2.2 jdk 安装

2.3 配置host

bash 复制代码
sudo vim /etc/hosts

10.128.0.18 hadoop01

10.128.0.21 hadoop02

10.128.0.22 hadoop03

前面为机器对应的内网ip。

3.zookeeper配置

创建zkData目录

bash 复制代码
mkdir -p /opt/data/zk/zkData

在目录下创建文件myid,内容为编号数字1~N。每台机器一个数字。

bash 复制代码
vim myid

1

在文件中添加与 server 对应的编号(注意:上下不要有空行,左右不要有空格)。

修改配置zoo.cfg文件

改conf 这个目录下的 zoo_sample.cfg 为 zoo.cfg

bash 复制代码
zoo_sample.cfg zoo.cfg

修改数据存储路径配置和增加服务器信息

bash 复制代码
# 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/data/zk/zkData
# 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.
#
# https://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

## Metrics Providers
#
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpHost=0.0.0.0
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true

server.1=hadoop01:2888:3888
server.2=hadoop02:2888:3888
server.3=hadoop03:2888:3888

4.启动集群

配置环境变量后,在每台机器上启动zkServer。

bash 复制代码
zkServer.sh start

验证zkServer状态

bash 复制代码
zkServer.sh status
相关推荐
Sayai16 分钟前
Kafka 去 ZooKeeper 实战评估:KRaft 模式架构解析与生产落地决策指南
zookeeper·架构·kafka
Sayai4 天前
Kafka 集群开启 SASL 认证实战(二):外置 ZooKeeper 之 kafka 与 zk 间认证
分布式·zookeeper·kafka
Sayai4 天前
Kafka 集群开启 SASL 认证实战(一):内置 ZooKeeper 场景,JAAS 配置全流程
分布式·zookeeper·kafka
Sayai4 天前
Kafka 集群开启 SASL 认证实战(三):外置 ZooKeeper 完整版,quorum 认证 + ACL 访问控制
zookeeper·kafka·linq
JavaPub-rodert7 天前
为什么 ZooKeeper 选择 CP,而 Eureka 选择 AP?
分布式·zookeeper·eureka
海兰7 天前
【Kafka进阶4】KRaft 完全指南:Apache Kafka 摆脱 ZooKeeper 的架构
zookeeper·kafka·apache
麻瓜记录Jackson9 天前
深入剖析 ZooKeeper 分布式 互斥锁:Curator 之 InterProcessMutex 源码全解(附图解)
java·spring boot·分布式·后端·zookeeper·java-zookeeper
爱吃面的猫18 天前
大数据Kafka3.x之——Kafka3.3.0安装与使用(详细)
大数据·分布式·zookeeper
TongSearch1 个月前
使用 TongZK 做服务注册与服务发现
zookeeper·服务发现·国产化·东方通·tongzk
AI人工智能+电脑小能手1 个月前
【大白话说Java面试题 第207题】【09_Zookeeper篇】第8题:谈谈 ZooKeeper 的可靠性保障机制
java·zookeeper·高可用·可靠性·分布式系统