在CentOS上清理Zookeeper日志,可参考以下方法:
sudo systemctl stop zookeeper。cp /path/to/zookeeper/logs/* /path/to/backup/logs/。find /path/to/zookeeper/logs/ -type f -mtime +7 -exec rm {} \;,可按需修改保留天数。sudo systemctl start zookeeper。zkCleanup.sh脚本:./zkCleanup.sh -n <count> [-d <dataDir>] [-l <dataLogDir>],可设置保留文件数量,通过crontab定时执行。zoo.cfg文件:设置autopurge.snapRetainCount和autopurge.purgeInterval参数,实现自动清理,如autopurge.purgeInterval=24(单位:小时),autopurge.snapRetainCount=5。