简体   繁体   中英

Apache Kafka: bootstrap-server is not a recognized option

I'm trying to set up Apache Kafka to communicate between two virtual machines running CentOS on the same network. I originally set up a Kafka producer and consumer on one machine and everything was running smoothly. I then set up Kafka on the other machine and in the process of trying to get them to connect, I get the error "bootstrap-server is not a recognized option" (I'm running the most recent version of Kafka, 2.2).

This is what I used to attempt a producer connection:

bin/kafka-console-producer.sh --bootstrap-server 10.0.0.11:9092 --topic test

And on the consumer side:

bin/kafka-console-producer.sh --bootstrap-server 10.0.0.11:9092 --topic test

The 10.0.0.11 machine is running the server itself.

According do Apache Kafka Documentation, that can be found here: https://kafka.apache.org/documentation/#quickstart_send , you should use --broker-list property to pass broker address.

Command will be: ./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test

EDIT

From Apache Kafka 2.5 both options are supported --broker-list and --bootstrap-server . Suggested one is --bootstrap-server

以下命令应该可以工作。

./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

./kafka-console-consumer.sh --zookeeper localhost:2181 --topic fred

Simply giving this command worked. However in upcoming major release using the option bootstrap-server will be mandatory.

When I use the above command it gives a warning: "Using the ConsoleConsumer with old consumer is deprecated and will be removed in a future major release. Consider using the new consumer by passing [bootstrap-server] instead of [zookeeper]."

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