Kafka 在指定的JAAS配置文件中找不到名为“Client”的JAAS配置节

t3psigkw  于 2023-02-03  发布在  Apache
关注(0)|答案(1)|浏览(752)

无法使用SASL身份验证部署Kafka这是我的docker-compose.yml

version: '3.1'

services:

  zookeeper:
    image: confluentinc/cp-zookeeper
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000
      ZOOKEEPER_INIT_LIMIT: 5
      ZOOKEEPER_SYNC_LIMIT: 2
      KAFKA_OPTS:
        -Djava.security.auth.login.config=/home/etozhekim/IdeaProjects/veles-core/zookeeper_server_jaas.conf
        -Dquorum.auth.enableSasl=true
        -Dquorum.cnxn.threads.size=20
        -Dzookeeper.authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider
        -DjaasLoginRenew=3600000
        -DrequireClientAuthScheme=sasl
    volumes:
      - /home/etozhekim/IdeaProjects/veles-core/zookeeper_server_jaas.conf
    networks:
      - kafka-cluster-network

  kafka:
    image: confluentinc/cp-kafka
    ports:
      - "9092:9092"
    depends_on:
      - zookeeper
    environment:
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_SASL_ENABLED_MECHANISMS: PLAIN
      KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL: PLAIN
      KAFKA_SECURITY_INTER_BROKER_PROTOCOL: SASL_PLAINTEXT
      KAFKA_LISTENERS: SASL_PLAINTEXT://kafka:9092,SASL_PLAINTEXT://kafka:9092
      KAFKA_ADVERTISED_LISTENERS: SASL_PLAINTEXT://localhost:9092,SASL_PLAINTEXT://localhost:9092
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_OPTS:
        -Dzookeeper.sasl.client=true
        -Djava.security.auth.login.config=/home/etozhekim/IdeaProjects/veles-core/kafka_server_jaas.conf
    volumes:
      - /home/etozhekim/IdeaProjects/veles-core/kafka_server_jaas.conf

Zookeeper的部署没有问题,但Kafka写道:
[2023-02-02 11:49:24,708]警告SASL配置失败。如果Zookeeper服务器允许,将继续连接到Zookeeper服务器,而不进行SASL验证。(org.apache.zookeeper.ClientCnxn)javax.security.auth.login.登录异常:在指定的JAAS配置文件中找不到名为“Client”的JAAS配置节:'/home/埃托热基姆/设计项目/veles-core/Kafka_服务器_jaas.conf'
Kafka_服务器_jaas.conf

KafkaServer {
    org.apache.kafka.common.security.scram.ScramLoginModule required
    username="kafkabroker"
    password="password";
};
Client {
    org.apache.kafka.common.security.plain.PlainLoginModule required
    username="admin"
    password="password";
};

zookeper_服务器_jaas.conf

Server {
  org.apache.zookeeper.server.auth.DigestLoginModule required
  user_admin="password";
};
vyu0f0g1

vyu0f0g11#

这个错误是说它需要一个Zookeeper客户端JAAS设置,而您只在代理中配置了Kafka客户端配置。
此外,融合图像中不存在/home/etozhekim
向卷添加有效的右侧容器Map,例如:/tmp/jaas.conf
然后使用-Djava.security.auth.login.config=/tmp/jaas.conf

相关问题