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

Solution 1:

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

Solution 2:

Speaking from experience, don't forget to edit the broker.id entries in the kafka-logs-*/meta.properties files to match your changes (or delete the files and let kafka regenerate them).