kafka集群搭建
- zookeeper集群搭建
- 从官网下载kafka,解压
- 配置
host.name=master
zookeeper.connect=master:2181,slave1:2181,slave2:2181
config/consumer.properties
zookeeper.connect=master:2181,slave1:2181,slave2:2181
config/producer.properties
metadata.broker.list=master:9092,slave1:9092,slave2:9092
- 启动(3台机器均启动)
./kafka-server-start.sh -daemon ../config/server.properties
./kafka-topics.sh --create --zookeeper master:2181 --replication-factor 1 --partitions 1 --topic test111
./kafka-topics.sh --list --zookeeper master:2181
./kafka-console-producer.sh --broker-list master:9092 --topic test111
./kafka-console-consumer.sh --zookeeper master:2181 --topic test111 --from-beginning