Use the CLI Kafka Tools included on your Kafka binary distribution to start the console consumer. This will print the data coming from the topic on your console. Start it using the following command:
bin/kafka-console-consumer.sh --bootstrap-server="host:port" --topic mytopic --group groupId --consumer-property security.protocol=SASL_SSL --consumer-property sasl.mechanism=SCRAM-SHA-256 --consumer-property auto.offset.reset=earliest #--consumer-property auto.offset.reset=latestBefore running the command, take the following settings:
Substitute <host:port>, <mytopic>, and <groupId>.
Mapp provides you with the connection endpoint, topic name, consumer group, and credentials.Specify the value for
auto.offset.reset(see section Configuration Properties for the Kafka Clients).
Alternatively, you can set the configuration properties in the "consumer.properties" file as follows:
#auto.offset.reset=earliest #auto.offset.reset=latest group.id=groupId security.protocol=SASL_SSL sasl.mechanism=SCRAM-SHA-256Now use the
--consumer.configparameter on the console consumer execution.bin/kafka-console-consumer.sh --bootstrap-server="host:port" --topic mytopic --consumer.config consumer.propertiesBefore running the command, substitute <host:port> and <mytopic>.
Run the CLI Kafka Tools
- 1 minute(s) read
Was this article helpful?