kafka密码配置

2019-05-21  本文已影响0人  于殿国
th?id=OHR.CRDelta_ZH-CN5088201492_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp.jpg

1、在 consumer.properties 、producer.properties 底部添加配置、

security.protocol=SASL_PLAINTEXT
sasl.mechanism=PLAIN

2、在 server.properties 文件中添加

security.inter.broker.protocol=SASL_PLAINTEXT
sasl.mechanism.inter.broker.protocol=PLAIN
sasl.enabled.mechanisms=PLAIN
authorizer.class.name = kafka.security.auth.SimpleAclAuthorizer
super.users=User:admin

3、启动配置修改 kafka-server-start.sh

export KAFKA_OPTS="-Djava.security.auth.login.config=/opt/kafka_2.12-2.1.1/config/kafka_server_jaas.conf"

4、zookper启动文件修改 zookeeper-server-start.sh

export KAFKA_OPTS=" -Djava.security.auth.login.config=/opt/kafka_2.12-2.1.1/config/kafka_zoo_jaas.conf”

5、添加新文件 kafka_server_jaas.conf

KafkaServer {
     org.apache.kafka.common.security.plain.PlainLoginModule required
     username="admin"
     password="ao123456c"
     user_admin="ao123456c"
     user_alice="Q3123456P";
 };


KafkaClient {
    org.apache.kafka.common.security.plain.PlainLoginModule required
    username="admin"
    password="ao123456c";
 };

6、添加新文件 kafka_zoo_jaas.conf

zookeeper {
  org.apache.kafka.common.security.plain.PlainLoginModule required
  username="alice"
  password="Q3123456P";
};

https://stackoverflow.com/questions/49773806/docker-compose-wurstmeister-kafka-failing-to-parse-kafka-opts

https://blog.csdn.net/u012040869/article/details/82589002

上一篇下一篇

猜你喜欢

热点阅读