There are 2 ways to provide the JAAS configuration to the Kafka clients.
-
Via the client property:
sasl.jaas.config
. In that case you set it to the actual JAAS configuration entry. For example, your configuration file becomes:bootstrap.servers=(address) zookeeper.connect=127.0.0.1:2181 zookeeper.connection.timeout.ms=6000 sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="(username)" password="(password)"; security.protocol=SASL_PLAINTEXT sasl.mechanism=PLAIN group.id=(group)
As you’ve already figured out, you can use
--command-config
to pass a properties file tokafka-consumer-groups.sh
. -
Via the Java property:
java.security.auth.login.config
. In this case, you set it to the path of your JAAS file. Also if you set it inKAFKA_OPTS
,kafka-consumer-groups.sh
will pick it up automatically.export KAFKA_OPTS="-Djava.security.auth.login.config=(path)/consumer_jaas.conf"