我已经使用sasl.jaas.config属性为kafka设置了jaas。我想要更新这个配置并动态添加用户。
根据这个doc-http://kafka.apache.org/11/documentation.html#dynamicbrokerconfigs,我们可以通过使用bin/kafka-configs.sh来实现这一点。
上面的doc有config列,如下所示-

我尝试用以下命令更新sasl.jaas.config:
bin/kafka-configs.sh --bootstrap-server localhost:9092 --entity-type brokers --entity-name 59 --alter --add-config sasl.jaas.config="KafkaServer {\n org.apache.kafka.common.security.plain.PlainLoginModule required\n username=\"myuser\"\n password=\"mypassword\";\n};\nClient {\n org.apache.zookeeper.server.auth.DigestLoginModule required\n username=\"myuser2\"\n password=\"mypassword2\";\n};"
但它给了我以下错误:
requirement failed: Invalid entity config: all configs to be added must be in the format "key=val"
如果我查看上面的列,它表示sasl.jaas.config属性值的格式是(=)*。这意味着什么?
如何传递“sasl.jaas.config”的值来动态更新jaas?
发布于 2019-02-27 13:29:33
虽然可以动态更新sasl.jaas.config以添加更多用户,但默认的平原登录模块并不打算用于生产中。
相反,您应该定义回调处理程序来处理用户的身份验证。这在Kafka Sasl平原博士中有描述。
另一个需要更多工作(但提供更多灵活性)的选项是创建您自己的登录模块。这个过程用可以为卡夫卡提供自定义LoginModule以支持LDAP吗?描述。
关于您得到的错误消息,这似乎是kafka-config.sh工具的一个问题。它并不期望配置值包含=。您应该能够使用AdminClient API更新该配置。
我找不到JIRA中存在的问题,所以创建了一个新的问题:https://issues.apache.org/jira/browse/KAFKA-8010
https://stackoverflow.com/questions/54900529
复制相似问题