如何正确更改kafka broker id

版本:kafka 0.9.0.0
操作:修改server.properties中的broker id
一般会得到如下错误:

Bash
[2018-08-26 00:41:54,540] ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.common.InconsistentBrokerIdException: Configured broker.id 2 doesn’t match stored broker.id 1 in meta.properties. If you moved your data, make sure your configured broker.id matches. If you intend to create a new broker, you should remove all data in your data directories (log.dirs).
at kafka.server.KafkaServer.getBrokerIdAndOfflineDirs(KafkaServer.scala:670)
at kafka.server.KafkaServer.startup(KafkaServer.scala:209)
at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:38)
at kafka.Kafka$.main(Kafka.scala:92)
at kafka.Kafka.main(Kafka.scala)
[2018-08-26 00:41:54,543] INFO shutting down (kafka.server.KafkaServer)

更正办法:手动修改meta.properties文件,在配置的log.dir下

BASIC
vi /tmp/kafka-logs/meta.properties

So, 如果你想改kafka的broker id,比如第一遍写错了,应该遵循两个步骤:

  1. 改server.prorperties文件配置;
  2. 改meta.properties,默认情况下,应该在/tmp/kafka-logs目录下;
    同时需注意数据存在多个目录时,需要修改多个目录的meta.propertie。
打赏 支付宝打赏 微信打赏

未经允许不得转载!

评论列表 0

访客
取消