windows版kafka添加用户名密码认证

./config 目录下创建配置文件

kafka_server_jaas.conf

 

Client {
	org.apache.kafka.common.security.plain.PlainLoginModule required
	username="admin"
	password="zk123!";
};
KafkaServer {
	org.apache.kafka.common.security.plain.PlainLoginModule required
	username="admin"
	password="kafka123!"
	user_admin="kafka123!"
	user_producer="producer123!"
	user_consumer="consumer123!";
};

kafka_zookeeper_jaas.conf

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

./config 目录下修改配置文件

zookeeper.properties 添加

# 安全身份认证
authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider
requireClientAuthScheme=sasl
jaasLoginRenew=3600000

server.properties 添加

#身份安装配置
#使用的认证协议
security.inter.broker.protocol=SASL_PLAINTEXT
#SASL机制 
sasl.enabled.mechanisms=PLAIN
sasl.mechanism.inter.broker.protocol=PLAIN
# 完成身份验证的类
#authorizer.class.name=kafka.security.auth.SimpleAclAuthorizer
# 如果没有找到ACL(访问控制列表)配置,则允许任何操作
allow.everyone.if.no.acl.found=true
#超级管理员权限用户
super.users=User:admin

server.properties 修改

listeners=SASL_PLAINTEXT://:9092

./bin/windows

zookeeper-server-start.bat 添加

set KAFKA_OPTS=-Djava.security.auth.login.config=file:%~dp0../../config/kafka_zookeeper_jaas.conf

 

kafka-server-start.bat 添加

set KAFKA_OPTS=-Djava.security.auth.login.config=file:%~dp0../../config/kafka_server_jaas.conf

 

你可能感兴趣的:(windows版kafka添加用户名密码认证)