Kafka “Login module not specified in JAAS config”

前端 未结 1 928
心在旅途
心在旅途 2020-12-10 12:34

I have a problem communicating with Kafka secured with sasl using console scripts. Kafka is secured with sasl, listener is SASL_PLAINTEXT

相关标签:
1条回答
  • 2020-12-10 12:57

    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 to kafka-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 in KAFKA_OPTS, kafka-consumer-groups.sh will pick it up automatically.

      export KAFKA_OPTS="-Djava.security.auth.login.config=(path)/consumer_jaas.conf"
      
    0 讨论(0)
提交回复
热议问题