1.搭建Zookeeper集群(伪分布式)。参考如下链接
https://mp.csdn.net/postedit/102797469
2.将下载的kafkatar.gz文件解压
tar zxvf kafka_2.11-2.2.1-kafka-4.1.0.tar.gz -C ~/app/
3.将afka_2.11-2.2.1-kafka-4.1.0/config/server.properties复制多份(一个server.properties就是一个broker)
[hadoop@hadoop002 config]$ cp server.properties server_01.properties
[hadoop@hadoop002 config]$ cp server.properties server_02.properties
[hadoop@hadoop002 config]$ cp server.properties server_03.properties
4.修改配置
[hadoop@hadoop002 config]$ vim server_01.properties
broker.id=0
host.name=hadoop002
log.dirs=/home/hadoop/tmp/kafka01/log/kafka-logs
port=9092
zookeeper.connect=hadoop002:2181,hadoop002:2182,hadoop002:2183/kafka
[hadoop@hadoop002 config]$ vim server_02.properties
broker.id=1
host.name=hadoop002
port=9093
log.dirs