管理topic
在本章的【安装部暑】上已经说明了如何去创建topic,下面我们看一下其它管理topic的命令:
查看:
[root@test12 kafka_2.12-2.3.0]# ./bin/kafka-topics.sh --list --zookeeper test11:2181
__consumer_offsets
my-replicated-topic
test1
test22
删除:
[root@test12 kafka_2.12-2.3.0]# ./bin/kafka-topics.sh --delete --zookeeper test11:2181 --topic my-replicated-topic
Topic my-replicated-topic is marked for deletion.
Note: This will have no impact if delete.topic.enable is not set to true.
修改:
[root@test12 kafka_2.12-2.3.0]# ./bin/kafka-topics.sh --describe --zookeeper test11:2181 --topic test22
Topic:test22 PartitionCount:1 ReplicationFactor:3 Configs:
Topic: test22 Partition: 0 Leader: 2 Replicas: 2,1,3 Isr: 1,3,2
[root@test12 kafka_2.12-2.3.0]# ./bin/kafka-topics.sh --bootstrap-server localhost:9092 --alter --topic test22 --partitions 3 #把topic test22原来的一个分区修改为3个分区
[root@test12 kafka_2.12-2.3.0]# ./bin/kafka-topics.sh --describe --zookeeper test11:2181 --topic test22
Topic:test22 PartitionCount:3 ReplicationFactor:3 Configs:
Topic: test22 Partition: 0 Leader: 2 Replicas: 2,1,3 Isr: 1,3,2
Topic: test22 Partition: 1 Leader: 3 Replicas: 3,2,1 Isr: 3,2,1
Topic: test22 Partition: 2 Leader: 1 Replicas: 1,3,2 Isr: 1,3,2
文档更新时间: 2019-07-05 16:24 作者:子木