查看topic详情
$ kafka-topics.sh --bootstrap-server 192.168.32.187:9092 --describe --topic test01
Topic: test01 TopicId: 1m19YRC3S9SIe2zvJQLMIw PartitionCount: 3 ReplicationFactor: 2 Configs: segment.bytes=1073741824
Topic: test01 Partition: 0 Leader: 2 Replicas: 2,0 Isr: 2,0
Topic: test01 Partition: 1 Leader: 1 Replicas: 1,2 Isr: 2,1
Topic: test01 Partition: 2 Leader: 0 Replicas: 0,1 Isr: 0,1
调整ISR顺序
$ zkCli.sh -server 192.168.32.187:2181
[zk: 192.168.32.187:2181(CONNECTED) 0] get /kafka/brokers/topics/test01/partitions/1/state
{"controller_epoch":14,"leader":1,"version":1,"leader_epoch":2,"isr":[2,1]}
[zk: 192.168.32.187:2181(CONNECTED) 1] set /kafka/brokers/topics/test01/partitions/1/state {"controller_epoch":14,"leader":1,"version":1,"leader_epoch":2,"isr":[1,2]}
更新元数据
[zk: 192.168.32.187:2181(CONNECTED) 2] create /kafka/isr_change_notification/isr_change_0000000001 {"version":1,"partitions":[{"topic":"test01","partition":1}]}
Created /kafka/isr_change_notification/isr_change_0000000001
- 需要修改
data 里面的内容
- 创建好该节点,更新完后马上又被controller删除。
验证
$ kafka-topics.sh --bootstrap-server 192.168.32.187:9092 --describe --topic test01
Topic: test01 TopicId: 1m19YRC3S9SIe2zvJQLMIw PartitionCount: 3 ReplicationFactor: 2 Configs: segment.bytes=1073741824
Topic: test01 Partition: 0 Leader: 2 Replicas: 2,0 Isr: 2,0
Topic: test01 Partition: 1 Leader: 1 Replicas: 1,2 Isr: 1,2
Topic: test01 Partition: 2 Leader: 0 Replicas: 0,1 Isr: 0,1