基礎設施環境 |
Kafka 環境 |
Kafka 版本 |
K8S 1.16 |
Strimzi Kafka |
2.6 |
[kafka@really-kafka-cluster-zookeeper-0 bin]$ ./kafka-topics.sh --bootstrap-server kafka-cluster-kafka-bootstrap:9092 --describe --topic CRM-EVENTSTopic: CRM-EVENTS PartitionCount: 6 ReplicationFactor: 3 Configs: message.format.version=2.6-IV0,max.message.bytes=52428800,unclean.leader.election.enable=false Topic: CRM-EVENTS Partition: 0 Leader: 1 Replicas: 1,2,0 Isr: 1,0,2 Topic: CRM-EVENTS Partition: 1 Leader: 2 Replicas: 1,2,0 Isr: 2,0,1 Topic: CRM-EVENTS Partition: 2 Leader: 0 Replicas: 1,2,0 Isr: 0,1,2 Topic: CRM-EVENTS Partition: 3 Leader: 1 Replicas: 1,2,0 Isr: 1,0,2 Topic: CRM-EVENTS Partition: 4 Leader: 2 Replicas: 1,2,0 Isr: 2,0,1 Topic: CRM-EVENTS Partition: 5 Leader: 0 Replicas: 1,2,0 Isr: 0,1,2[kafka@really-kafka-cluster-zookeeper-0 bin]$ ./kafka-topics.sh --describe --zookeeper localhost:12181 --topic CRM-EVENTSTopic: CRM-EVENTS PartitionCount: 6 ReplicationFactor: 3 Configs: Topic: CRM-EVENTS Partition: 0 Leader: 1 Replicas: 1,2,0 Isr: 1,0,2 Topic: CRM-EVENTS Partition: 1 Leader: 2 Replicas: 1,2,0 Isr: 2,0,1 Topic: CRM-EVENTS Partition: 2 Leader: 0 Replicas: 1,2,0 Isr: 0,1,2 Topic: CRM-EVENTS Partition: 3 Leader: 1 Replicas: 1,2,0 Isr: 1,0,2 Topic: CRM-EVENTS Partition: 4 Leader: 2 Replicas: 1,2,0 Isr: 2,0,1 Topic: CRM-EVENTS Partition: 5 Leader: 0 Replicas: 1,2,0 Isr: 0,1,2
副本擴容Json 檔案
{ "version": 1, "partitions": [ { "topic": "CRM-EVENTS", "partition": 0, "replicas": [ 1, 2, 0 ] }, { "topic": "CRM-EVENTS", "partition": 1, "replicas": [ 1, 2, 0 ] }, { "topic": "CRM-EVENTS", "partition": 2, "replicas": [ 1, 2, 0 ] }, { "topic": "CRM-EVENTS", "partition": 3, "replicas": [ 1, 2, 0 ] }, { "topic": "CRM-EVENTS", "partition": 4, "replicas": [ 1, 2, 0 ] }, { "topic": "CRM-EVENTS", "partition": 5, "replicas": [ 1, 2, 0 ] } ]}
關係圖
執行命令./kafka-reassign-partitions.sh --zookeeper kafka-cluster-zookeeper-nodes:12181 --reassignment-json-file /tmp/crm-events.json --execute./kafka-reassign-partitions.sh --zookeeper kafka-cluster-zookeeper-nodes:12181 --reassignment-json-file /tmp/crm-events.json --verify
全域性預設配置:
num.partitions=6default.replication.factor=3