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
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.
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.
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 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 .
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.
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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With