MongoDB实现日志自动切割

1、编写js脚本

db.runCommand({logRotate:1})

2、编写windows批处理

mongo -u root -p root -authenticationDatabase admin localhost/admin "D:Program FilesMongoDBServer3.2dataackuplogRotate.js"

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

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

原文地址:https://www.cnblogs.com/seastar1989/p/6594176.html