–Topic increase
/opt/tools/kafka_2.11-0.11.0.3/bin/kafka-topics.sh --zookeeper 10.170.52.166:2181 --create --topic flightReserved --replication-factor 1 --partitions 1
/opt/tools/kafka_2.11-0.11.0.3/bin/kafka-topics.sh --zookeeper 10.170.52.166:2181 --alter --topic flightReserved --replication-factor 1 --partitions 2
/opt/tools/kafka_2.11-0.11.0.3/bin/kafka-topics.sh --zookeeper 10.170.52.166:2181 --describe |grep flightReserved
–Partition reassignment
./kafka-reassign-partitions.sh --generate --zookeeper 10.170.52.166:2181 --topics-to-move-json-file test.json --broker-list “1,2”
test.json
{“topics”:
[{“topic”: “flightReserved”}],
“version”:1
}
Save the result to reassginment.json
{“version”:1,“partitions”:[{“topic”:“flightReserved”,“partition”:2,“replicas”:[1]},{“topic”:“flightReserved”,“partition”:5,“replicas”:[2]},{“topic”:“flightReserved”,“partition”:4,“replicas”:[1]},{“topic”:“flightReserved”,“partition”:1,“replicas”:[2]},{“topic”:“flightReserved”,“partition”:3,“replicas”:[2]},{“topic”:“flightReserved”,“partition”:0,“replicas”:[1]}]}
./kafka-reassign-partitions.sh --zookeeper 10.170.52.166:2181 --reassignment-json-file reassginment.json --execute
./kafka-reassign-partitions.sh --zookeeper 10.170.52.166:2181 --reassignment-json-file reassginment.json --verify
–modify replication
increase-replication-factor.json
{“version”:1,
“partitions”:[
{“topic”:“flightReserved”,“partition”:0,“replicas”:[1,2]}
]}
./kafka-reassign-partitions.sh --zookeeper 10.170.52.166:2181 --reassignment-json-file increase-replication-factor.json --execute
/opt/tools/kafka_2.11-0.11.0.3/bin/kafka-topics.sh --zookeeper 10.170.52.166:2181 --describe |grep flightReserved