【问题标题】:Failed to start broker after enabling Zookeeper Authentication启用 Zookeeper 身份验证后无法启动代理
【发布时间】:2018-02-26 15:27:37
【问题描述】:

使用以下属性启动 Zookeeper,即 zookeeper.properties

dataDir=/tmp/zookeepeeer              
clientPort=2186        
maxClientCnxns=0        
auto.offset.reset=smallest        
authProvider.1=org.apache.zookeeper.server.auth.DigestAuthenticationProvider       
jaasLoginRenew=3600000        
requireClientAuthScheme=sasl

zookeeper_jaas.conf

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

Server.properties

group.initial.rebalance.delay.ms=0        
authorizer.class.name=kafka.security.auth.SimpleAclAuthorizer        
listeners=SASL_PLAINTEXT://localhost:9092        
security.inter.broker.protocol= SASL_PLAINTEXT        
sasl.mechanism.inter.broker.protocol=PLAIN        
sasl.enabled.mechanisms=PLAIN        
super.users=User:admin        
zookeeper.set.acl=true  

Kafka_server_jaaz.conf

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

错误如下 java.lang.SecurityException: zookeeper.set.acl is true, but the verification of the JAAS login file failed.

我尝试了以下解决方案,但尽管进行了更改,但它再次失败并出现以下错误

kafka_server_jaaz.conf

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

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

server.properties同上
但它失败并出现以下错误:
[2018-02-23 10:16:04,459] 错误 ACL 无效 (kafka.utils.ZKCheckedEphemeral)
[2018-02-23 10:16:04,459] 错误 ACL 无效 (kafka.utils.ZKCheckedEphemeral)
[2018-02-23 10:16:04,460] 致命 [Kafka Server 0],KafkaServer 期间出现致命错误
启动。准备关机 (kafka.server.KafkaServer)
org.I0Itec.zkclient.exception.ZkException:
org.apache.zookeeper.KeeperException$InvalidACLException: KeeperErrorCode = InvalidACL

【问题讨论】:

    标签: authentication apache-kafka apache-zookeeper acl


    【解决方案1】:

    在 Kafka 中,您还需要配置连接到 Zookeeper 时将使用的 SASL 客户端。这是使用 Kafka JAAS 配置中的 Client 上下文完成的,例如

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

    如果需要,可以使用zookeeper.sasl.clientconfig 系统属性更改上下文名称。

    【讨论】:

    • 感谢您的快速回复,我们会试用并回复您
    • 这对我有用
    猜你喜欢
    • 2016-02-06
    • 2013-12-23
    • 2018-06-07
    • 1970-01-01
    • 1970-01-01
    • 2018-08-05
    • 2023-03-22
    • 2017-07-31
    • 1970-01-01
    相关资源
    最近更新 更多