单机部署
下载二进制包
cd /opt/soft/archive
wget http://archive.apache.org/dist/kafka/3.2.0/kafka_2.12-3.2.0.tgz
tar -zxf kafka_2.12-3.2.0.tgz -C ../
cd ../kafka_2.12-3.2.0
修改配置
vim config/server.propertiesadvertised.listeners=PLAINTEXT://39.105.11.50:9092
启动
sh bin/zookeeper-server-start.sh -daemon config/zookeeper.properties
sh bin/kafka-server-start.sh -daemon config/server.properties
集群部署
按照单机部署方式启动多个Zookeeper与broker节点。
修改config/server.properties配置:
- broker.id 每个节点唯一
- zookeeper.connect: 改成zookeeper节点
查看集群状态:
bin/kafka-topics.sh --zookeeper <zookeeper_host>:<zookeeper_port> --describe
性能测试
sh bin/kafka-producer-perf-test.sh --help
sh bin/kafka-consumer-perf-test.sh --help