zookeeper配置安全认证
时间: 2023-11-25 11:51:30 浏览: 38
以下是zookeeper配置安全认证的步骤:
1.下载并解压zookeeper和kafka,进入zookeeper的conf目录,创建jaas文件,添加如下内容:
```shell
Server {
org.apache.zookeeper.server.auth.DigestLoginModule required
user_admin="admin-password"
user_user1="user1-password";
};
```
其中,user_admin和user_user1是用户名,admin-password和user1-password是对应的密码。
2.修改zookeeper的配置文件zoo.cfg,添加如下内容:
```shell
authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider
requireClientAuthScheme=sasl
jaasLoginRenew=3600000
```
3.进入kafka的config目录,修改server.properties文件,添加如下内容:
```shell
listeners=SASL_PLAINTEXT://:9092
sasl.mechanism.inter.broker.protocol=PLAIN
sasl.enabled.mechanisms=PLAIN
security.inter.broker.protocol=SASL_PLAINTEXT
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
username="admin" \
password="admin-password";
```
其中,username是zookeeper中的用户名,password是对应的密码。
4.重启zookeeper和kafka。