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.
标签:
apache-kafka
相关问题
- Delete Messages from a Topic in Apache Kafka
- Serializing a serialized Thrift struct to Kafka in
- Kafka broker shutdown while cleaning up log files
- Getting : Error importing Spark Modules : No modul
- How to transform all timestamp fields when using K
相关文章
- Kafka doesn't delete old messages in topics
- Kafka + Spark Streaming: constant delay of 1 secon
- Spring Kafka Template implementaion example for se
- How to fetch recent messages from Kafka topic
- Determine the Kafka-Client compatibility with kafk
- Kafka to Google Cloud Platform Dataflow ingestion
- Kafka Producer Metrics
- Spark Structured Streaming + Kafka Integration: Mi
And, 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).
Make sure in your
server.properties
andserverTest.properties
you have differentlog.dirs
If you had to make any
log.dirs
changes don't forget to remove previous folders stored on your PCThis is old question, still this answer should help others. The problem is when you create new server.properties from existing server.properties, below line will get copied:
So, even new broker tries to use the same log dir and hence it uses the meta.properties of kafka-logs which is created by broker 0 and has broker id as 0.
So, go to /tmp and delete all kafka-logs* files and then comment
log.dirs=/tmp/kafka-logs
and then add the lines as you have added :)The answers are perfect but it took me a while to figure it out to get it work. I would like to share my mistake and hope others can avoid it.
I followed the official tutorial with kafka here:
https://kafka.apache.org/quickstart#quickstart_multibroker.
and make a file copy as suggested in the guide:
I open the file using vim. I do a search for broker.id and replace with the following(mistake by assuming there is no existing listeners and log.dirs) as below
I started a new broker with
crashed!!!. This is how I debug:
I went /tmp and checked the dir kafka-logs-1 did not appear. I realized that there should be something wrong with my log.dir in config. I double checked it in the config/server-1.propeties. I found that there were two lines of log.dirs.
Of course the last one overridden the first one thus making the new broker point to the first broker with id=0.
After removing the last log.dirs and keep only one log.dirs ( log.dirs=/tmp/kafka-logs-1 ) works like a charm.
Edit config/serverTest.properties and replace the existing config values as follows:
If you want a third broker:
Edit config/server3.properties and replace the existing config values as follows:
if you run on different machines you must change
else if you run in the same vmware machine, for example you should only change the port and log.dir as described above