简体   繁体   中英

why kafka producer use --broker-list while customer use --bootstrap-server?

for consumer

bin/windows/kafka-console-consumer.bat --bootstrap-server localhost:9092 --top
irer

and for producer

bin/windows/kafka-console-producer.bat --broker-list localhost:9092 --topic test

because I think for producer, we can also only choose one broker, from this broker server, we can find the all the partition information and find the leader, so I don't think broker-list is really needed.

This is for historical reasons, in either case, the provided brokers are only used to bootstrap and discover the full cluster.

Before Kafka 0.9, the consumer was still using Zookeeper to bootstrap. At that time, the producer was already using --broker-list .

In 0.9, when the "new" consumer was added, the flag to specify the broker was named --bootstrap-server for good reason as it is exactly what it is. Since then, the tools have used different flag name even though they are the same thing.

This was annoying and finally in 2.5.0, released just a few weeks ago, all tools have been updated to use --bootstrap-server !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM