Kafka 集群部署

本文档详细介绍了如何在三个节点上部署Kafka集群,依赖Zookeeper服务。首先确保Zookeeper正常运行,然后分别配置三台服务器的Kafka broker.id、网络参数、日志目录等,并设置Zookeeper连接信息。启动时使用kafka-server-start.sh脚本,关闭则用kafka-server-stop.sh。最后,展示了创建主题、生产消息和消费消息的测试命令。
摘要由CSDN通过智能技术生成

1.这里版本的kafka是基于zookeeper  是先安装好 zookeeper不能出现问题 

        kafka_2.11-2.4.1.tgz

2.解压安装包,重命名该压缩包.

 tar -zxvf  kafka_2.11-2.4.1.tgz

mv kafka_2.11-2.4.1 kafka-2.11

 3.在配置文件中修改配置

 第一台

broker.id=1

num.network.threads=3

num.io.threads=8

delete.topic.enable=true

socket.send.buffer.bytes=102400

socket.receive.buffer.bytes=102400

socket.request.max.bytes=104857600

log.dirs=/opt/soft/kafka-2.11/logs

num.partitions=1

num.recovery.threads.per.data.dir=1

offsets.topic.replication.factor=1

transaction.state.log.replication.factor=1

transaction.state.log.min.isr=1

log.retention.hours=168

log.segment.bytes=1073741824

log.retention.check.interval.ms=300000

zookeeper.connect=node01:2181,node02:2181,node03:2181/kafka

zookeeper.connection.timeout.ms=6000

group.initial.rebalance.delay.ms=0

第二台

broker.id=2

num.network.threads=3

num.io.threads=8

delete.topic.enable=true

socket.send.buffer.bytes=102400

socket.receive.buffer.bytes=102400

socket.request.max.bytes=104857600

log.dirs=/opt/soft/kafka-2.11/logs

num.partitions=1

num.recovery.threads.per.data.dir=1

offsets.topic.replication.factor=1

transaction.state.log.replication.factor=1

transaction.state.log.min.isr=1

log.retention.hours=168

log.segment.bytes=1073741824

log.retention.check.interval.ms=300000

zookeeper.connect=node01:2181,node02:2181,node03:2181/kafka

zookeeper.connection.timeout.ms=6000

group.initial.rebalance.delay.ms=0

第三台

broker.id=3

num.network.threads=3

num.io.threads=8

delete.topic.enable=true

socket.send.buffer.bytes=102400

socket.receive.buffer.bytes=102400

socket.request.max.bytes=104857600

log.dirs=/opt/soft/kafka-2.11/logs

num.partitions=1

num.recovery.threads.per.data.dir=1

offsets.topic.replication.factor=1

transaction.state.log.replication.factor=1

transaction.state.log.min.isr=1

log.retention.hours=168

log.segment.bytes=1073741824

log.retention.check.interval.ms=300000

zookeeper.connect=node01:2181,node02:2181,node03:2181/kafka

zookeeper.connection.timeout.ms=6000

group.initial.rebalance.delay.ms=0

4.启动指令和关闭指令

/opt/soft/kafka-2.11/bin/kafka-server-start.sh -daemon /opt/soft/kafka-2.11/config/server.properties

/opt/soft/kafka-2.11/bin/kafka-server-stop.sh

5.kafka测试指令

/opt/soft/kafka-2.11/bin/kafka-console-producer.sh --broker-list node01:9092 --topic first

/opt/soft/kafka-2.11/bin/kafka-console-consumer.sh --bootstrap-server node01:9092 --from-beginning --topic first

/opt/soft/kafka-2.11/bin/kafka-topics.sh --zookeeper node01:2181/kafka --list

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值