监控告警提示,mongo数据库硬盘使用预警,查看文件大小,确定是日志文件过大
[root@tts log]# ll -h
total 36G
-rw-r--r--. 1 root root 19G Sep 20 17:24 r2.log
-rw-r--r--. 1 root root 17G Sep 20 17:24 r3.log
查看mongo进程
[root@tts log]# ps -ef|grep mongo
root 2330 1 0 2016 ? 2-06:43:51 /appl/mongodb/bin/mongod --replSet rs1/*****:30000,*****:30001 --fork --port 30002 --dbpath /appl/mongodb/data/r3 --logpath=/appl/mongodb/data/log/r3.log --logappend
root 2379 1 7 2016 ? 24-20:06:41 /appl/mongodb/bin/mongod --replSet rs1 --fork --port 30001 --dbpath /appl/mongodb/data/r2 --logpath=/appl/mongodb/data/log/r2.log --logappend --oplogSize=5000
登录mongo库,切换到admin,利用db.runCommand生成新的日志文件
[root@tts bin]# ./mongo --port 30001
MongoDB shell version: 2.2.0
connecting to: 127.0.0.1:30001/test
rs1:PRIMARY> use admin
switched to db admin
rs1:PRIMARY> db.runCommand({logRotate:1});
{ "ok" : 1 }
rs1:PRIMARY> exit
bye
查看日志文件情况
[root@tts log]# ll -h
total 36G
-rw-r--r--. 1 root root 26K Sep 20 17:30 r2.log
-rw-r--r--. 1 root root 19G Sep 20 17:29 r2.log.2017-09-20T09-29-58
-rw-r--r--. 1 root root 17G Sep 20 17:30 r3.log
清理原来的日志文件(删除或移走)
版权声明:本文为博主原创文章,未经博主允许不得转载。
mongo日志清理
- 上一篇:sysaux表空间清理
- 下一篇:ORACLE 12cR2单机补丁升级






