• mongodb 日志清理


    #!/bin/bash
    #Rotate the MongoDB logs to prevent a single logfile from consuming too much disk space.
    #app=mongod
    #mongodPath=/root/mongodb-linux-x86_64-rhel62-3.5.10/bin
    backpath=/data/backup/
    
    echo  "rs.slaveOk();db.runCommand({logRotate:1});" >/tmp/logappend.js
    chmod 755 /tmp/logappend.js
    /usr/local/mongo/bin/mongo --port 27017 -u "root" -p "MANAGER" --authenticationDatabase "admin"  admin /tmp/logappend.js
    
    mv /data/mongodb/replset/mongod.log.20* $backpath
    find $backpath -mtime +3 -name "mongod.log.20*" -exec rm -rf {} ;
  • 相关阅读:
    socket
    netstat
    列表
    突然发现不会写代码了
    算法资源
    bit位操作
    排序算法
    连续子数组最大和
    books
    凸优化
  • 原文地址:https://www.cnblogs.com/kcxg/p/10796554.html
Copyright © 2020-2023  润新知