public void addNumPartitions(String name, int numPartitions) throws ExecutionException, InterruptedException { Map<String, NewPartitions> partitionsMap = new HashMap<>(); NewPartitions newPartitions = NewPartitions.increaseTo(numPartitions); partitionsMap.put(name, newPartitions); adminClient.createPartitio...
kafka-reassign-partitions.sh --bootstrap-server ${kafkaAddress} --reassignment-json-file config/increase-replication-factor.json --execute 3.创建topic话题 bin/kafka-topics.sh --create --topic test --bootstrap-server192.168.218.128:9092-partitions3-replication-factor1查看所有topic话题 bin/kafka-topic...
./bin/kafka-reassign-partitions.sh --zookeeper 127.0.0.1:2181 --reassignment-json-file increase-replication-factor.json --execute 1. #查看副本情况 ./bin/kafka-reassign-partitions.sh --zookeeper 127.0.0.1:2181 --reassignment-json-file increase-replication-factor.json --verify 1. #查看分区信息 ka...
"org.apache.kafka.common.serialization.StringSerializer"); props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer"); AdminClient adminClient = AdminClient.create(props); NewPartitions newPartitions = NewPartitions.increaseTo(20); adminClient....
kafka-topics.sh --bootstrap-server ${kafkaAddress} --topic ${topicName} --alter --partitions 4 b.创建increase-replication-factor.json in config,配置各分区replication-factor位置 {"version":1,"partitions":[{"topic":"${topicName}","partition":0,"replicas":[0,1]},{"topic":"${topicName...
/config/increase-replication-factor.json {"version":1, "partitions":[ {"topic":"ranger_audits","partition":0,"replicas":[1001,1003]}, {"topic":"ranger_audits","partition":1,"replicas":[1002,1004]}, {"topic":"ranger_audits","partition":2,"replicas":[1001,1003]}, {"topic":"...
(注意:尽量保持topic的原有每个分区的主备份不变化。因此,配置文件的每个分区的第一个broker保持不变。) [root@tbds bin]# vim ../config/increase-replication-factor.json {"version":1, "partitions":[ {"topic":"ranger_audits","partition":0,"replicas":[1001,1003]}, {"topic":"ranger_audits","...
Go build && topic = dummytopic num_partitions = 30 brokerid_start = 1022 replica_count = 3 ....
其中,—topic表示主题名称,—partitions表示分区数,—replication-factor表示副本数,—config表示主题配置,会覆盖默认的配置项。 可以使用下述命令删除topic: > bin/kafka-topics.sh --bootstrap-server broker_host:port --delete --topic my_topic_name
创建increase-replication-factor.json 文件 $ cat increase-replication-factor.json {"version":1,"partitions":[{"topic":"testTopic","partition":0,"replicas":[0,1,2]},{"topic":"testTopic","partition":1,"replicas":[0,1,2]},{"topic":"testTopic","partition":2,"replicas":[0,1,2]},...