1、kafka下载
https://kafka.apache.org/downloads
2、解压
tar -zxvf kafka_2.13_3.8.0.tgz
3、配置server.properties(基本上这些参数了,大部分都默认配置好了)
node.id=1
controller.quorum.voters=1@localhost:9093
listeners=PLAINTEXT://:9092,CONTROLLER://:9093
advertised.listeners=PLAINTEXT://192.168.2.101:9092
controller.listener.names=CONTROLLER
inter.broker.listener.name=PLAINTEXT
offsets.topic.replication.factor=1
transaction.state.log.replication.factor=1
transaction.state.log.min.isr=1
log.dirs=/opt/kafka_2.13-3.8.0/logs
listener.security.protocol.map=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL
num.partitions=3
4、进入kafka
cd kafka_2.13_3.8.0
5、生成集群uuid,整个集群中的唯一ID
bin/kafka-storage.sh random-uuid
Aif05KxIQPCS9nVnFntTwA
bin/kafka-storage.sh format -t AxKQMINIRZ2bsPIV-azgXA -c config/kraft/server.properties
6、启动kafka
bin/kafka-server-start.sh -daemon config/kraft/server.properties
7、查看日志是否启动成功
cd logs
tail -f server.log
8、查看端口是否启动
netstat -nltp