Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

zookeeper is not a recognized option when executing kafka-console-consumer.sh

I'm learning how to use Kafka on this website link(except I'm using port 2182 in zookeeper), but it shows:

zookeeper is not a recognized option

after executing:

sudo ./bin/kafka-console-consumer.sh --topic test --zookeeper localhost:2182

How to fix it?

Env:

kafka_2.11-2.1.0 zookeeper-3.4.10 
like image 710
xingbin Avatar asked Nov 22 '18 10:11

xingbin


People also ask

Does Kafka consumer need ZooKeeper?

For the latest version (2.4. 1) ZooKeeper is still required for running Kafka, but in the near future, ZooKeeper dependency will be removed from Apache Kafka. See the high-level discussion in KIP-500: Replace ZooKeeper with a Self-Managed Metadata Quorum.

Is ZooKeeper deprecated in Kafka?

ZooKeeper would be deprecated in the release after that, and removed in Kafka 4.0. Targeted for August, Kafka 3.3 would include options for both ZooKeeper and KRaft. The end-of-life date for ZooKeeper is undetermined.

Does Kafka no longer require zookeeper connection string?

Newer versions (2.2 and above) of Kafka no longer require ZooKeeper connection string ie --zookeeper localhost:2181 and throw Exception in thread "main". ./kafka-topics.sh --create --topic test-topic --bootstrap-server localhost:9092 --replication-factor 1 --partitions 4

How to fix option Zookeeper is deprecated?

How to fix it? Option zookeeper is deprecated, use --bootstrap-server instead. remove 'bin' and execute the command from 'bin/windows' folder. From version 2.1.* the previous answers may not work, always check the official documentation , this answer provided with version 3.1.0 .

What is the difference between bootstrap-server and Zookeeper?

If i use the zookeeper option, the consumer reads messages, whereas if i use bootstrap-server option i am not able to read messages. any thoughts.

What is Kafka-console-consumer?

Kafka-console-consumer simply reads from a Kafka topic and writes data to console (standard output). By default, it outputs the raw bytes in the message with no formatting (using the Default Formatter). How to Consume Data from Kafka using Kafka Console Consumer?


1 Answers

I find the answer on the QUICKSTART:

Option zookeeper is deprecated, use --bootstrap-server instead.

Now it works:

bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning 
like image 105
xingbin Avatar answered Sep 22 '22 23:09

xingbin