Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st. We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here. Need help or have questions? Drop us a line at [email protected]
In a non-Kerberized environment, for Kafka console consumer command displays all messages, perform the following:
Note: Here, <broker_host> is Kafka broker hostname, <zk_host> is zookeeper hostname and Kafka port will be 6667:
Using Old consumer API (prior to HDP 2.5.x), run the following:
bin/kafka-console-consumer.sh --zookeeper <zk_host>:2181 --topic test --from-beginning
Using New consumer API ( From HDP 2.5.x onwards), run the following:
bin/kafka-console-consumer.sh --bootstrap-server <broker_host>:6667 --topic test --from-beginnin
To view a specific number of message in a Kafka topic, use the --max-messages option. To view the oldest message, run the console consumer with --from-beginning and --max-messages 1:
Using Old consumer API ( Prior to HDP 2.5.x):
bin/kafka-console-consumer.sh --zookeeper <zk_host>:2181 --topic test --from-beginning --max-messages 1
Using New consumer API ( From HDP 2.5.x onwards):
bin/kafka-console-consumer.sh --bootstrap-server <broker_host>:6667 --topic test --from-beginning --max-messages
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].