测试topic创建和删除
/opt/kafka/bin/kafka-topics.sh --create --zookeeper node01:2181,node02:2181,node03:2181 --topic test-topic --partitions 3 --replication-factor 3
/opt/kafka/bin/kafka-topics.sh --zookeeper node01:2181,node02:2181,node03:2181 -list
[root@localhost zookeeper]# /opt/kafka/bin/kafka-topics.sh --zookeeper node01:2181,node02:2181,node03:2181 -describe --topic test-topic
Topic: test-topic PartitionCount: 3 ReplicationFactor: 3 Configs:
Topic: test-topic Partition: 0 Leader: 2 Replicas: 2,3,1 Isr: 2,3,1
Topic: test-topic Partition: 1 Leader: 3 Replicas: 3,1,2 Isr: 3,1,2
Topic: test-topic Partition: 2 Leader: 1 Replicas: 1,2,3 Isr: 1,2,3
/opt/kafka/bin/kafka-topics.sh --delete --zookeeper node01:2181,node02:2181,node03:2181 --topic test-topic
产生者
/opt/kafka/bin/kafka-console-producer.sh --broker-list node01:9092,node02:9092,node03:9092 -topic test-topic
消费者
/opt/kafka/bin/kafka-console-consumer.sh --bootstrap-server node01:9092,node02:9092,node03:9092 -topic test-topic --from-beginning
评论区