Zookeeper 安装

本文详细介绍了如何从下载Zookeeper开始,一步步配置并搭建Zookeeper集群。包括选择Apache或CDH版本,解压安装,配置文件修改,设置数据与日志目录,客户端连接端口,以及如何在多个节点上配置和测试运行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1  下载zookeeper

Apache 版本下载地址:https://archive.apache.org/dist/

CDH 版本下载地址:http://archive-primary.cloudera.com/cdh5/cdh/5/

根据需要下载自己的版本即可。

我习惯将软件安装在/data目录下 ,

2  解压Zookeeper 

tar -zxvf zookeeper-3.4.5-cdh5.10.0.tar.gz

3 修改配置文件

 首先进入config目录下:

拷贝配置文件:

cp zoo_sample.cfg  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=/data/zookeeper/zkdata
#日志目录需要提前创建
dataLogDir=/data/zookeeper/zkdatalog
# the port at which the clients will connect
clientPort=2181
#
# 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.每个节点服务编号=服务器ip地址:集群通信端口:选举端口
server.1=10.1.1.18:2888:3888
#server.2=hadoop02:2888:3888   根据自己的节点情况进行配置 
#server.3=hadoop03:2888:3888
 

注:配置集群  直接将上述配置好的分发到其他节点即可
4 修改每个节点服务编号

进入/data/zookeeper/zkdata 目录,创建myi的文件 

主节点可以在myid里面写入1  

注:各个节点之前必须保持不同

5 测试运行

/bin/zkServer.sh start 

出现如下内容说明启动成功

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值