zoukankan      html  css  js  c++  java
  • zookeeper定时清理log

    在zookeeper的目录下新建一个脚本,内容如下(zookeeper bin下面也有zkCleanup.sh脚本,原理一样,都是调用java类)

    shell_dir=$(cd "$(dirname "$0")"; pwd)
    
    cd $shell_dir && java -cp zookeeper-3.4.5.jar:lib/log4j-1.2.15.jar:lib/slf4j-api-1.6.1.jar:lib/slf4j-log4j12-1.6.1.jar:conf/log4j.properties org.apache.zookeeper.server.PurgeTxnLog /zoo-datadir/ /zoo-datadir/ -n 5

    其中/zoo-datadir对应dataDir和dataLogDir,-n代表保留的snapshot的数量,默认是3,加入crontab,每天执行crontab -e

    0 */1 * * * /root/zookeeper/zookeeper-3.4.5/purgeTxnLog.sh 

    service crond restart

    如果是zookeeper3.4之后的版本,可以通过修改zoo.cfg配置文件的形式,zookeeper自动清理

    # The number of snapshots to retain in dataDir
    autopurge.snapRetainCount=3
    # Purge task interval in hours
    # Set to "0" to disable auto purge feature
    autopurge.purgeInterval=1
  • 相关阅读:
    Android Lint简介
    免费HTTP数据抓包Fiddler2[4.6.1.2]以及显示中文包内容的方法
    IE6、7下bug
    图表插件
    学习:使用svg
    jQuery Transit
    jQuery基础学习笔记(1)
    HTTP协议详解学习
    html5学习笔记
    html释疑
  • 原文地址:https://www.cnblogs.com/yanghuahui/p/3514225.html
Copyright © 2011-2022 走看看