Kafka备忘

1. 开多个partition

bin/kafka-topics.sh --alter --zookeeper {zookeeperServer}:2181 --partitions 扩到多少 --topic 主题名

2.扩容后topic迁移(3台扩4台)

vi topics-to-move.json
{"topics":
    [{"topic":"{topicName}"}],
    "version": 1
}
bin/kafka-reassign-partitions.sh --zookeeper {zookeeperServer}:2181 --topics-to-move-json-file topics-to-move.json --broker-list "1,2,3,4" --generate

 

vi topic-reassignment.json

将roposed partition reassignment configuration中的内容复制进去
bin/kafka-reassign-partitions.sh --zookeeper {zookeeperServer}:2181 --reassignment-json-file topic-reassignment.json --execute

3.平衡Leader

bin/kafka-preferred-replica-election.sh --zookeeper {zookeeperServer}:2181

4.kafka自带压测命令

bin/kafka-producer-perf-test.sh --topic {topicName} --num-records 100 --record-size 1 --throughput 100  --producer-props bootstrap.servers={kafkaServer}:9092

 

你可能感兴趣的:(kafka,Linux,kafka)