Windows Install Kafka

1.下载地址

kafka下载地址

2.解压安装

使用解压工具对压缩包进行解压

3.配置参数
  • 配置参数
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
broker.id=0
#listeners=PLAINTEXT://:9092
#advertised.listeners=PLAINTEXT://your.host.name:9092
num.network.threads=3
num.io.threads=8
socket.send.buffer.bytes=102400
socket.receive.buffer.bytes=102400
socket.request.max.bytes=104857600
# log存放位置
log.dirs=F:\\kafka_2.12-2.0.0\\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.flush.interval.messages=10000
#log.flush.interval.ms=1000
log.retention.hours=168
#log.retention.bytes=1073741824
log.segment.bytes=1073741824
log.retention.check.interval.ms=300000
# 连接zookeeper集群地址
zookeeper.connect=localhost:2181,localhost:2182,localhost:2183
zookeeper.connection.timeout.ms=6000
group.initial.rebalance.delay.ms=0
4.启动
启动Server:
1
.\kafka-server-start.bat server.properties
创建topic
1
.\bin\windows\kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test3
查看topic
1
.\bin\windows\kafka-topics.bat --list --zookeeper localhost:2181
producer启动
1
.\bin\windows\kafka-console-producer.bat --broker-list localhost:9092 --topic test
consumer启动
1
.\kafka_2.12-2.0.0\bin\windows\kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test  --from-beginning

kafka源码地址​github.com