kafka中的zookeeper介绍及搭建

介绍

zookeeper是一个分布式的协调服务,主要用于维护集群的元数据信息和配置信息。kafka集群依赖其存储、管理自身元数据、配置。

zk在kafka集群的作用

在这里插入图片描述

1、管理监控broker节点:broker的上下线、broker的ip地址及端口,实现fail over和load balance;;
2、存储、管理集群的元数据信息和配置:topic分配、partition分配、leader副本、follower副本;

环境

systemctl stop firewalld && systemctl disable firewalld
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

vi /etc/hosts
ip1 node1
ip2 node2
ip3 node3

安装配置

#全节点
yum install -y java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-devel.x86_64

tar -xvf apache-zookeeper-3.7.1-bin.tar.gz
mkdir -p /apache-zookeeper-3.7.1-bin/data
mkdir -p /apache-zookeeper-3.7.1-bin/log

cp conf/zoo_sample.cfg conf/zoo.cfg

cat 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=/apache-zookeeper-3.7.1-bin/data
# the port at which the clients will connect
clientPort=2181

## Metrics Providers
#
# https://prometheus.io Metrics Exporter
# metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
# metricsProvider.httpPort=7000
# metricsProvider.exportJvmInfo=true
dataLogdir=/apache-zookeeper-3.7.1-bin/log
server.1=ip1:2888:3888
server.2=ip2:2888:3888
server.3=ip3:2888:3888

#节点1至3
echo "1" > /apache-zookeeper-3.7.1-bin/data/myid
echo "2" > /apache-zookeeper-3.7.1-bin/data/myid
echo "3" > /apache-zookeeper-3.7.1-bin/data/myid

#启动、停止
./zkServer.sh start
./zkServer.sh stop

kafka: link

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值