zookeeper 日志清除机制

来源:互联网 发布:打印机软件怎么安装 编辑:程序博客网 时间:2024/05/16 10:13

在使用zookeeper中会生成大量的日志信息和快照数据,若定期不清理会导致磁盘占盘,从而影响服务的正常运行。目前版本的zookeeper 有提供参数用于清理日志文件(log)和快照文件(snapshot)。

zoo.cfg文件

# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial# synchronization phase can takeinitLimit=10# The number of ticks that can pass between# sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just# example sakes.dataDir=/home/ekanet/esb/zookeeper-3.4.6/data# the port at which the clients will connectclientPort=2181# the maximum number of client connections.# increase this if you need to handle more clients#maxClientCnxns=60## Be sure to read the maintenance section of the# administrator guide before turning on autopurge.## http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance# The number of snapshots to retain in dataDirautopurge.snapRetainCount=20# Purge task interval in hours# Set to "0" to disable auto purge feature   autopurge.purgeInterval=5server.1=zk-server-01:2888:3888server.2=zk-server-02:2888:3888server.3=zk-server-03:2888:3888

autopurge.purgeInterval=5 

autopurge.snapRetainCount=20 

上面设置的参数表示:间隔5个小时清理一次,log文件保存20个,snapshot快照文件保存20个。若zookeeper启动时超过设置的文件时,就会执行删除文件的操作。


间隔5个小时会执行清理日志的定时任务,删除log和快照超过设定值的文件。

原创粉丝点击