MongoDB实现日志自动切割

1、编写js脚本

db.runCommand({logRotate:1})

2、编写windows批处理

mongo -u root -p root -authenticationDatabase admin localhost/admin "D:\Program Files\MongoDB\Server\3.2\data\backup\logRotate.js"

 3、建立计划任务,定时执行

注:如果是linux系统下编写sh脚本即可

posted @ 2017-03-21 14:28  原地没有风  阅读(1585)  评论(0编辑  收藏  举报