Debug Confluent Cloud using kafkacat

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

Follow these instructions to use kafkacat with Confluent Cloud.

  1. Install kafkacat using these instructions.

  2. Export the Confluent Cloud bootstrap server and credentials using environment variables.

    export CCLOUD_BOOTSTRAP_SERVER=<bootstrap_server>
    export CCLOUD_API_KEY=<ccloud_api_key>
    export CCLOUD_API_SECRET=<ccloud_api_secret>
    
  3. Use the environment variables and the two required api.version.request option to connect to Confluent Cloud:

    kafkacat -b ${CCLOUD_BOOTSTRAP_SERVER} -L -X security.protocol=SASL_SSL -X sasl.mechanisms=PLAIN \
     -X sasl.username=${CCLOUD_API_KEY} -X sasl.password=${CCLOUD_API_SECRET} \
     -X api.version.request=true
    

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

    Tip

    If you get an error like Failed to verify broker certificate: unable to get local issuer certificate, check your kafkacat version. In kafkacat versions prior to 0.11.0, it did not fall back to the system-installed certs. For more information, see the kafkacat issue.

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 Utility.