skip to Main Content

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.

3

Answers


  1. 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

    Login or Signup to reply.
  2. Following command should work.

    ./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
    
    Login or Signup to reply.
  3. ./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].”

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search