tester-technology

修改kafka分区数

2019-05-06  本文已影响0人  testerzhang

这里记录下如何修改kafka的topic分区

$ ./kafka-topics.sh --describe --zookeeper xxx.xxx.xxx.xxx:端口1,xxx.xxx.xxx.xxx:端口2,xxx.xxx.xxx.xxx:端口3 --topic testtopic


Topic:testtopic     PartitionCount:1        ReplicationFactor:1     Configs:
        Topic: testtopic    Partition: 0    Leader: 2       Replicas: 2     Isr: 2
$ ./kafka-topics.sh --alter  --zookeeper xxx.xxx.xxx.xxx:端口1,xxx.xxx.xxx.xxx:端口2,xxx.xxx.xxx.xxx:端口3 --topic testtopic --partitions 4


WARNING: If partitions are increased for a topic that has a key, the partition logic or ordering of the messages will be affected
Adding partitions succeeded!
$  ./kafka-topics.sh --describe --zookeeper xxx.xxx.xxx.xxx:端口1,xxx.xxx.xxx.xxx:端口2,xxx.xxx.xxx.xxx:端口3 --topic testtopic 

Topic:testtopic     PartitionCount:4        ReplicationFactor:1     Configs:
        Topic: testtopic    Partition: 0    Leader: 2       Replicas: 2     Isr: 2
        Topic: testtopic    Partition: 1    Leader: 3       Replicas: 3     Isr: 3
        Topic: testtopic    Partition: 2    Leader: 1       Replicas: 1     Isr: 1
        Topic: testtopic    Partition: 3    Leader: 2       Replicas: 2     Isr: 2
上一篇下一篇

猜你喜欢

热点阅读