MongoDB log relative to other databases should be a very large, just because of the alarm, so I look at a bit, there is a 15G log generation, the following is my cleanup process
For security reasons, our server prohibits the use of RM commands, so I created a Mongolog folder in the/home directory
Check the log size and number first
#ls/opt/mongodb/log
Total 15G
-rw-r--r--. 1 root root 6.6G Jul 2 17:10 mongodb.log
-rw-r--r--. 1 root root 6.5K Oct mongodb.log.2013-10-16t13-13-26
-rw-r--r--. 1 root root 1.6K Oct mongodb.log.2013-10-23t10-10-45
-rw-r--r--. 1 root root 112M Jan 17:10 mongodb.log.2014-01-16t11-08-59
-rw-r--r--. 1 root root 8.0G Apr 8 23:53 mongodb.log.2014-04-09t01-17-33
#mkdir/home/mongolog
Then look at the process number of MongoDB
#ps-ef | grep MONGO
[Email protected] log]# Ps-ef | grep MONGO
Root 9033 7254 0 17:17 pts/0 00:00:00 grep MONGO
Root 10771 1 9 Apr09? 7-23:16:33 bin/mongod-f etc/mongo.conf
The process number found is 10771.
The following signal to the process, let the program to regenerate the log, which does not affect the service situation of MongoDB
KILL-SIGUSR1 10771
Check the size and number of logs again.
#ls/opt/mongodb/log
Total 15G
-rw-r--r--. 1 root root 0 Jul 2 17:11 mongodb.log
-rw-r--r--. 1 root root 6.5K Oct mongodb.log.2013-10-16t13-13-26
-rw-r--r--. 1 root root 1.6K Oct mongodb.log.2013-10-23t10-10-45
-rw-r--r--. 1 root root 112M Jan 17:10 mongodb.log.2014-01-16t11-08-59
-rw-r--r--. 1 root root 8.0G Apr 8 23:53 mongodb.log.2014-04-09t01-17-33
-rw-r--r--. 1 root root 6.6G Jul 2 17:11 mongodb.log.2014-07-02t09-11-18
Isn't it more than a log
Then move the log to the directory you just created.
#mv mongodb.log.201*/home/mongolog/
This article is from the "Jeff" blog, so be sure to keep this source http://zhangxz.blog.51cto.com/5490116/1433638