6

I have a SASL PLAIN configured Kafka but can't connect to it using cli and the documentation is not clear. Below is the command I am using as of now.

bin/kafka-topics.sh --list --bootstrap-server localhost:9093

Any help will be appreciated.

Upendra
  • 127
  • 1
  • 7

1 Answers1

12

There's a section in the Kafka documentation that details the required configuration to connect to a cluster with SASL Plain: https://kafka.apache.org/documentation/#security_sasl_plain_clientconfig

It lists the following settings:

security.protocol=SASL_SSL
sasl.mechanism=PLAIN
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
        username="alice" \
        password="alice-secret";

Obviously depending on the SSL configuration, you may need to add a few extra settings, see https://kafka.apache.org/documentation/#security_configclients

Put all these settings in a file, then you can specify this file using the --command-config when using kafka-topics.sh. For example:

bin/kafka-topics.sh --list --bootstrap-server localhost:9093 --command-config /path/to/file.properties
Mickael Maison
  • 25,067
  • 7
  • 71
  • 68