Debugging Confluent Cloud using kafkacat

You can use the kafkacat Utility to debug Confluent Cloud deployments. You can use the kafkacat is a command line utility to test and debug Apache Kafka deployments. It is a generic non-JVM producer and consumer for Apache Kafka. Per the kafkacat documentation, you can think of it as a “netcat for Apache Kafka”.

Follow these instructions to use kafkacat with Confluent Cloud.

  1. Install kafkacat using these instructions.

  2. Export the Confluent Cloud broker list and credentials using environment variables.

    $ export CCLOUD_BROKERS=<broker_list>
    $ export CCLOUD_ACCESS_KEY_ID=<username>
    $ export CCLOUD_SECRET_ACCESS_KEY=<password>
  3. Use the environment variables and the two required options ( and api.version.request) to connect to Confluent Cloud:

    $ kafkacat -b ${CCLOUD_BROKERS} -L -X security.protocol=SASL_SSL -X sasl.mechanisms=PLAIN \
      -X sasl.username=${CCLOUD_ACCESS_KEY_ID} -X sasl.password=${CCLOUD_SECRET_ACCESS_KEY} \
      -X -X api.version.request=true

    The api.version.request option is required because Confluent Cloud runs Apache Kafka version 0.10+. For more information about kafkacat and Apache Apache Kafka broker version compatibility, see this document.

To learn more about specific kafkacat options, run kafkacat -h. A useful flag is -v, which prints useful information when debugging.

For more information, see the kafkacat documentation.