运行 Kafka ACL 命令失败

Running Kafka ACL Commands fail

我正在尝试 运行 添加、删除和列出任何 kafka acl 命令。一个示例命令是:

../bin/kafka-acls.sh --authorizer-properties zookeeper.connect=localhost:2181 --add --allow-principal User:demouser --operation Create --operation Describe --topic demo-topic

但我总是得到错误:

Error while executing ACL command: Exception while loading Zookeeper JAAS login context 'Client'
org.apache.kafka.common.KafkaException: Exception while loading Zookeeper JAAS login context 'Client'
    at org.apache.kafka.common.security.JaasUtils.isZkSecurityEnabled(JaasUtils.java:45)
    at kafka.admin.AclCommand$AuthorizerService.withAuthorizer(AclCommand.scala:197)
    at kafka.admin.AclCommand$AuthorizerService.addAcls(AclCommand.scala:221)
    at kafka.admin.AclCommand$.main(AclCommand.scala:70)
    at kafka.admin.AclCommand.main(AclCommand.scala)
Caused by: java.lang.SecurityException: java.io.IOException: /remote/sde108/kafka/kafka/config/config.conf (No such file or directory)
    at sun.security.provider.ConfigFile$Spi.<init>(ConfigFile.java:137)
    at sun.security.provider.ConfigFile.<init>(ConfigFile.java:102)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at javax.security.auth.login.Configuration.run(Configuration.java:255)
    at javax.security.auth.login.Configuration.run(Configuration.java:247)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.login.Configuration.getConfiguration(Configuration.java:246)
    at org.apache.kafka.common.security.JaasUtils.isZkSecurityEnabled(JaasUtils.java:42)
    ... 4 more
Caused by: java.io.IOException: /remote/sde108/kafka/kafka/config/config.conf (No such file or directory)
    at sun.security.provider.ConfigFile$Spi.ioException(ConfigFile.java:666)
    at sun.security.provider.ConfigFile$Spi.init(ConfigFile.java:262)
    at sun.security.provider.ConfigFile$Spi.<init>(ConfigFile.java:135)
    ... 15 more

根据我的搜索,kafka 或 zookeeper 安装中没有名为 config.conf 的文件。有没有人遇到类似或相同的问题并且知道如何解决?

移动评论回答。

根据错误,您以某种方式加载了 JAAS 文件。

这些可以在环境变量中设置,你会发现像 env | grep KAFKA