zookeeper sasl身份验证问题

mnemlml8  于 2022-12-20  发布在  Apache
关注(0)|答案(2)|浏览(503)

我正试图为我的KafkaZookeeper设置SASL认证。我按照下面链接中提到的所有步骤
https://cwiki.apache.org/confluence/display/ZOOKEEPER/Client-Server+mutual+authentication
下面是保存在/home目录中的server_jaas.conf文件

Server {
   org.apache.kafka.common.security.plain.PlainLoginModule required
   username="admin"
   password="admin-secret"
   user_admin="admin-secret"
};

下面是我的java.env文件配置

SERVER_JVMFLAGS="-Djava.security.auth.login.config=/home/server_jaas.conf"

下面是我得到的错误

2017-08-01 16:49:40,774 [myid:] - ERROR [main:ServerCnxnFactory@199] - No JAAS configuration section named 'Server' was foundin '/home/server_jaas.conf'.
2017-08-01 16:49:40,774 [myid:] - ERROR [main:ZooKeeperServerMain@64] - Unexpectked exception, exiting abnormally
java.io.IOException: No JAAS configuration section named 'Server' was foundin '/home/server_jaas.conf'.
    at org.apache.zookeeper.server.ServerCnxnFactory.configureSaslLogin(ServerCnxnFactory.java:200)
    at org.apache.zookeeper.server.NIOServerCnxnFactory.configure(NIOServerCnxnFactory.java:82)
    at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:117)
    at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:87)
    at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:53)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:116)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78)
li9yvcax

li9yvcax1#

尝试添加;到服务器定义的末尾

Server {
   org.apache.kafka.common.security.plain.PlainLoginModule required
   username="admin"
   password="admin-secret"
   user_admin="admin-secret";
};
ru9i0ody

ru9i0ody2#

配置文件的内容可能如下所示:

Server {
   org.apache.kafka.common.security.plain.PlainLoginModule required
   username="admin"
   password="admin-secret"
   user_admin="admin-secret";
};

并确保/home/server_jaas.conf的位置正确。
我得到了同样的异常,因为我给了一个错误的位置,这个配置文件。

相关问题