ZooKeeper audit is disabled

时间:2024-03-23 08:19:21

1.整合zookeeper使用的过程中发现控制台输出 ZooKeeper audit is disabled,搜索一番发现不少文章都是说版本问题

ZooKeeper audit is disabled
2.查看源码发现日志由zookeeper.audit.enable开关控制,即42行是else的部分

ZooKeeper audit is disabled

3.继续往下查看,找到名字为zookeeper.audit.enable变量,实际上是加载的系统变量

ZooKeeper audit is disabled

3.查看启动脚本zkServer.sh 发现call方法中可以设置变量值

ZooKeeper audit is disabled

4.设置结果如下

ZooKeeper audit is disabled

 

5.重新启动控制台输出ZooKeeper audit is enabled.

ZooKeeper audit is disabled

6.后续搜索发现是因为zookeeper新版本启动的过程中,zookeeper新增的审核日志是默认关闭,所以控制台输出ZooKeeper audit is disabled,标准的修改方式应该是在zookeeper的配置文件zoo.cfg新增一行audit.enable=true即可

参考:https://blog.csdn.net/csdnzxm/article/details/105646728