Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 755
Abigail Fox Avatar asked May 08 '19 17:05

Abigail Fox


3 Answers

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

like image 74
Bartosz Wardziński Avatar answered Nov 04 '22 20:11

Bartosz Wardziński


Following command should work.

./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
like image 36
Rajesh Goyal Avatar answered Nov 04 '22 19:11

Rajesh Goyal


./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]."

like image 1
DJAdmin Avatar answered Nov 04 '22 19:11

DJAdmin