kafka 集群

部署准备

至少三台服务器,Zookeeper 集群

安装

Kafka 安装包准备

Kafka 下载页面

配置文件修改

server.properties

properties 复制代码
# The id of the broker. This must be set to a unique integer for each broker.
broker.id=0
# The address the socket server listens on.
listeners=PLAINTEXT://x.x.x.x:9092
# A comma separated list of directories under which to store log files
# 数据文件存放地址
log.dirs=/home/bigdata/kafka/log
# Zookeeper connection string 
# 最后的 /kafka 是zk上的路径信息,如果不写,默认在根目录下展开 kafka 元数据信息,容易于其他系统冲突
zookeeper.connect=x.x.x.x:2181/kafka

分发配置文件到所有节点

shell 复制代码
# 复制 hadoop 安装包的解压文件夹到所有的机器
scp -r kafka_2.12-3.7.0 root@x.x.x.x:$PWD

其他节点配置文件修改

server.properties

修改 broker.id 。不能出现重复

properties 复制代码
# The id of the broker. This must be set to a unique integer for each broker.
broker.id=0
# The address the socket server listens on.
listeners=PLAINTEXT://x.x.x.x:9092

配置环境变量

shell 复制代码
export export KAFKA_HOME=/usr/bigdata/kafka_2.12-3.7.0
export PATH=$PATH:$KAFKA_HOME/bin

启动集群

所有节点执行启动命令

shell 复制代码
kafka-server-start.sh -daemon ${配置文件绝对路径}
相关推荐
这个DBA有点耶3 小时前
2026年分布式数据库有哪些主流选择?先评估这5个维度再决定
数据库·分布式·dba
pnoker1 天前
IoT DC3 消息总线:六适配器可插拔设计
物联网·架构·kafka·消息队列·rabbitmq
cxhello1 天前
消费者活着、心跳正常、日志干净,但它七天没拉过一条消息
python·kafka
Lost of 程序猿1 天前
ASP.NET Core Saga 分布式事务深度实战:备件采购跨服务长流程,如何保证“要么全成,要么全回“
分布式·后端·asp.net
XiYang-DING1 天前
地图城市缓存优化:ApplicationReadyEvent + Caffeine + Redis + Redisson 分布式锁
redis·分布式·缓存
2601_962175661 天前
RabbitMQ 的工作模式
分布式·rabbitmq
头茬韭菜2 天前
图解 Fluss(四):分布式协调 —— 选举、副本状态机与
分布式·fluss
2601_962218612 天前
万象生鲜系统全链路溯源一码查询技术实现食材来源可查
分布式·微服务·云原生·架构
Dreams_l2 天前
RabbitMQ介绍及其工作模式
分布式·rabbitmq
2601_962218612 天前
万象生鲜系统大数据采购预测算法降低库存积压稳居第一
分布式·微服务·云原生·架构