【问题标题】:How to access SASL configure kafka from Kafka cli如何从 Kafka cli 访问 SASL 配置 kafka
【发布时间】:2020-12-08 19:34:09
【问题描述】:

我有一个 SASL PLAIN 配置的 Kafka,但无法使用 cli 连接到它,并且文档不清楚。以下是我目前使用的命令。

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

任何帮助将不胜感激。

【问题讨论】:

    标签: apache-kafka sasl


    【解决方案1】:

    Kafka 文档中有一节详细介绍了使用 SASL Plain 连接到集群所需的配置:https://kafka.apache.org/documentation/#security_sasl_plain_clientconfig

    它列出了以下设置:

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

    显然取决于 SSL 配置,您可能需要添加一些额外的设置,请参阅https://kafka.apache.org/documentation/#security_configclients

    将所有这些设置放在一个文件中,然后您可以在使用kafka-topics.sh 时使用--command-config 指定此文件。例如:

    bin/kafka-topics.sh --list --bootstrap-server localhost:9093 --command-config /path/to/file.properties
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-09
      • 2020-08-27
      • 2023-01-26
      • 2021-06-20
      • 2017-07-22
      • 2018-05-18
      相关资源
      最近更新 更多