Skip to content

Instantly share code, notes, and snippets.

@peterkowalski
Created November 16, 2021 17:06
Show Gist options
  • Save peterkowalski/00fff04b65bd6ef8d81c6805cf1612c4 to your computer and use it in GitHub Desktop.
Save peterkowalski/00fff04b65bd6ef8d81c6805cf1612c4 to your computer and use it in GitHub Desktop.
[kcat usage with authentication] How to use kcat as producer / consumer and provide credentials #kafka #aws
# Metadata listing mode
kcat -L \
-b $KAFKA_BROKER:9096 \
-X security.protocol=SASL_SSL \
-X sasl.mechanisms=SCRAM-SHA-512 \
-X sasl.username=$USERNAME \
-X sasl.password=$PASSWORD
# Producer mode
kcat -t $KAFKA_TOPIC -P \
-b $KAFKA_BROKER:9096 \
-X security.protocol=SASL_SSL \
-X sasl.mechanisms=SCRAM-SHA-512 \
-X sasl.username=$USERNAME \
-X sasl.password=$PASSWORD
# Consumer mode
kcat -t $KAFKA_TOPIC \
-b $KAFKA_BROKER:9096 \
-f '\nKey (%K bytes): %k\t\nValue (%S bytes): %s\n\Partition: %p\tOffset: %o\n--\n' \
-X security.protocol=SASL_SSL \
-X sasl.mechanisms=SCRAM-SHA-512 \
-X sasl.username=$USERNAME \
-X sasl.password=$PASSWORD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment