三、Kafka验证部署

bridge
2022-01-27 / 0 评论 / 0 点赞 / 1,329 阅读 / 957 字 / 正在检测是否收录...
温馨提示:
本文最后更新于 2022-01-27,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

测试topic创建和删除

  • 创建topic
/opt/kafka/bin/kafka-topics.sh --create --zookeeper node01:2181,node02:2181,node03:2181 --topic test-topic --partitions 3 --replication-factor 3
  • 查询topic列表
/opt/kafka/bin/kafka-topics.sh --zookeeper node01:2181,node02:2181,node03:2181 -list
  • 查询topic明细
[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
  • 删除topic
/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
0

评论区