第一種方式普通複製限流:
第二種:帶有限流的分區重分配的用法
第一步:設置broker端限流參數
kafka-configs.sh --zookeeper localhost:2181/kafka --entity-type brokers --entity-name 2 --alter --add-config follower.replication.throttled.rate=10,leader.replication.throttled.rate=10
第二步:指定哪個主題的哪些leader副本和follow副本複製時被限流
kafka-configs.sh --zookeeper localhost:2181/kafka --entity-type topics --entity-name topic-throttle --alter --add-config leader.replication.throttled.replicas=[0:1,0:2,2:0,2:1],follower.replication.throttled.replicas=[0:0,0:2]
第三步:執行分區重分配
kafka-reassign-partitions.sh --zookeeper hadoop1:2181/kafka --execute --reassignment-json-file project.json
第四步:查看分區重分配的進度(重分配就是創建一個新的副本並從leader複製數據)
kafka-reassign-partitions.sh --zookeeper hadoop1:2181/kafka --verify --reassignment-json-file project.json
第三種:kafka-reassign-partitions.sh(推薦)
kafka-reassign-partitions.sh --zookeeper localhost:2181/kafka --execute --reassignment-json-file project.json --throttle 10
kafka-reassign-partitions.sh --zookeeper hadoop1:2181/kafka --verify --reassignment-json-file project.json