有人能帮助在docker compose中启用wurstmeister/zookeeper和wurstmeister/kafka的SASL身份验证吗?我在没有身份验证的情况下运行这些,一切都很好,但是我不能设置简单的用户名/密码身份验证。
zookeeper:
image: wurstmeister/zookeeper
ports:
- "2181:2181"
kafka:
build: ./kafka
depends_on:
- zookeeper
ports:
- "9095:9095"
hostname: kafka
environment:
KAFKA_ADVERTISED_PORT: 9095
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_HOST_NAME: kafka
KAFKA_LISTENERS: SASL_PLAINTEXT://:9095
KAFKA_ADVERTISED_LISTENERS: SASL_PLAINTEXT://kafka:9095
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_OPTS: "-Djava.security.auth.login.config=/etc/kafka/kafka_server_jaas.conf"
KAFKA_INTER_BROKER_LISTENER_NAME: SASL_PLAINTEXT
KAFKA_SASL_ENABLED_MECHANISMS: PLAIN
KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL: PLAIN
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./kafka_server_jaas.conf:/etc/kafka/kafka_server_jaas.conf
jaas. 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"
user_admin="admin-secret";
};
我计划连接到在Node.js上运行Kafkajs的Docker容器中的Kafka
1条答案
按热度按时间t1rydlwq1#
我得到了SASL身份验证工作与
wurstmeister
图像与以下配置。停靠-撰写.yml:
Zookeeper_jaas.配置文件:
Kafka_服务器_jaas.配置文件:
需要在生产者/消费者中设置以下附加Kafka客户端属性: