Run the CLI Kafka Tools
    • 1 Minute to read
    • Dark
      Light

    Run the CLI Kafka Tools

    • Dark
      Light

    Article summary

    1. 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=latest
    2. Before 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).

    3. 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-256
    4. Now use the --consumer.config parameter on the console consumer execution.

      bin/kafka-console-consumer.sh --bootstrap-server="host:port" --topic mytopic --consumer.config consumer.properties
    5. Before running the command, substitute <host:port> and <mytopic>.


    Was this article helpful?