一、说明
- centos7.9
- kafka_2.13-2.7.0.tgz
- apache-zookeeper-3.8.0-bin.tar.gz
- 官方文档:Apache Kafka
二、kafka配置
2.1、server.properties
server.properties修改或增加如下配置
listeners=SASL_PLAINTEXT://你的主机ip:9092
super.users=User:admin
authorizer.class.name=kafka.security.authorizer.AclAuthorizer
security.inter.broker.protocol=SASL_PLAINTEXT
sasl.mechanism.inter.broker.protocol=PLAIN
sasl.enabled.mechanisms=PLAIN
allow.everyone.if.no.acl.found=false
2.2、kafka_server_jaas.conf
在config目录下创建如下文件kafka_server_jaas.conf
KafkaServer {
org.apache.kafka.common.security.plain.PlainLoginModule required
username="admin"
password="admin-secret"
user_admin="admin-secret"
user_alice="alice-secret";
};
3.2、kafka-server-start.sh
export KAFKA_OPTS="$KAFKA_OPTS -Djava.security.auth.login.config=$base_dir/../config/kafka_server_jaas.conf"
3.3、启动kafka节点
sh kafka-server-start.sh -daemon ../config/server.properties
三、补充说明(未测试)文章来源:https://www.toymoban.com/news/detail-856173.html
网上还有一种说法,在server.properties增加如下配置,便不需要kafka_server_jaas.conf文件文章来源地址https://www.toymoban.com/news/detail-856173.html
listener.name.sasl_plaintext.plain.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
username="admin" \
password="admin-secret" \
user_admin="admin-secret" \
user_alice="alice-secret";
到了这里,关于kafka部署之简单密钥的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!