kafka-3、zookeeper下载安装配置

集群配置前提:Java环境

下载

zookeeper-3.4.13

链接:https://pan.baidu.com/s/1XWIEo_kEmNQx7hlcQ31OSw 
提取码:d5rs 

安装

在/usr/local中新建zookeeper目录

下载的安装包放在该目录下

解压

tar -zxvf /usr/local/zookeeper/zookeeper-3.4.13.tar.gz

解压后目录如下:

配置

1、修改conf下的zoo_sample.cfg 为zoo.cfg

2、在根目录下创建logs和data目录

修改后配置如下

# 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/zookeeper-3.4.13/data
# 日志存放的位置
dataLogDir=/usr/local/zookeeper/zookeeper-3.4.13/logs
# 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
# 集群的配置,后面为你的 ip,后面有节点依次往下面排
server.1=192.168.1.11:2888:3888
server.2=192.168.1.17:2888:3888
server.3=192.168.1.18:2888:3888

注意ip换成你自己的IP

3、修改日志文件

Zookeeper 默认会将控制台信息输出到启动路径下的 zookeeper.out 中,通过如下方法,可以让 Zookeeper 输出按尺寸切分的日志文件:

  修改 conf/log4j.properties 文件,将

           zookeeper.root.logger=INFO, CONSOLE

     改为

          zookeeper.root.logger=INFO, ROLLINGFILE

修改bin/zkEnv.sh文件,将

           ZOO_LOG4J_PROP="INFO,CONSOLE"

    改为

          ZOO_LOG4J_PROP="INFO,ROLLINGFILE"

其他服务器也按照这样的格式修改

4、创建myid文件

cd /usr/local/zookeeper/zookeeper-3.4.13/data

创建myid文件

文件内容如下

1
#上面的zoo.cfg中文件的server中的数字是几就在该服务上面配置几

5、启动服务

切换到bin目录下

./zkServer.sh start #启动

./zkServer.sh status #查看状态

./zkServer.sh stop #停止

6、启动成功

7、验证集群可用性

我这里选用3台服务器,会通过选举出来leader,暂停leader后,会重新选举,即是代表启动成功

至此zookeeper集群搭建完毕,具体配置文件信息自行百度

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值