The ZOO_ENABLE_AUTH environment variable does not configure authentication. Set the environment variable ALLOW_ANONYMOUS_LOGIN=yes to allow unauthenticated users to connect to ZooKeeper.
时间: 2024-03-16 19:44:50 浏览: 19
这个错误是因为你设置了 `ZOO_ENABLE_AUTH` 环境变量,但是没有进行认证配置,导致出现了错误。如果你需要使用认证功能,需要在 `zoo.cfg` 文件中进行相应的配置。具体操作如下:
1. 在 `zoo.cfg` 文件中添加以下内容:
```
authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider
requireClientAuthScheme=sasl
jaasLoginRenew=3600000
```
2. 创建 `zookeeper_jaas.conf` 文件,添加以下内容:
```
Server {
org.apache.zookeeper.server.auth.DigestLoginModule required
user_admin="admin-password"
user_user1="user1-password";
};
```
其中,`user_admin` 和 `user_user1` 是需要进行认证的用户名,`admin-password` 和 `user1-password` 是对应的密码。
3. 在启动 ZooKeeper 时,添加 `-Djava.security.auth.login.config=/path/to/zookeeper_jaas.conf` 参数,指定 JAAS 配置文件的路径。
如果你不需要使用认证功能,可以设置 `ALLOW_ANONYMOUS_LOGIN=yes` 环境变量来允许未认证的用户连接到 ZooKeeper。