Search code examples
apache-kafka

Launching multiple Kafka brokers fails - Configured brokerId doesn't match stored brokerId


While trying to launch multiple Kafka brokers with different brokerId's. One being the default server.properties and the other being serverTest.properties with 2 lines changed, those being broker.id=1 and listeners=PLAINTEXT://localhost:6000. The rest is the same default setting. I first start zookeeper, then the default kafka server.properties then while launching serverTest.properties I get the following exception: kafka.common.InconsistentBrokerIdException: Configured brokerId 1 doesn't match stored brokerId 0 in meta.properties. My understanding is that the following above should actually launch multiple nodes, as I've seen others do in tutorials. I'm using Kafka 9.0.


Solution

  • Edit config/serverTest.properties and replace the existing config values as follows:

    broker.id=2
    listeners=PLAINTEXT://9093
    log.dirs=/tmp/kafka-logs-2
    

    If you want a third broker:

    cp config/server.properties config/server3.properties
    

    Edit config/server3.properties and replace the existing config values as follows:

    broker.id=3
    listeners=PLAINTEXT://:9094
    log.dirs=/tmp/kafka-logs-3
    

    if you run on different machines you must change

    advertised.listeners=PLAINTEXT://192.168.x.x:<port>
    

    else if you run in the same vmware machine, for example you should only change the port and log.dir as described above