MongoDB logs are growing rapidly, and the space where var is located is immediately full. Even if you change to another disk partition to save the logs, the logs are still growing rapidly, and the disk is about to crash. There is a good way to use rotating logs. MongoDB's rotating log is a bit strange, the mongd service in Linux receives a kill-SGIUSR1 command immediately after the current log
MongoDB logs are growing rapidly, and the space of/var is immediately full. Even if you switch to another disk partition to save the logs, the logs are still growing rapidly, and the disk is about to be closed. There is a good way to use rotating logs. MongoDB's rotation log is a bit strange. in Linux, The mongd Service receives a kill-SGIUSR1 command and immediately sends the current log
MongoDB logs are growing rapidly, and the space of/var is immediately full. Even if you switch to another disk partition to save the logs, the logs are still growing rapidly, and the disk is about to be closed.
There is a good way to use rotating logs.
MongoDB's rotation log is a bit strange. in Linux, The mongd Service accepts the kill-SGIUSR1 command and immediately renames the current log file to a file with a date, and then creates a new log file.
If you do not want to rotate logs normally, you can configure a rotation policy. But it does not matter. After testing, the MongoDB service will not be affected when the command is sent.
The following is an example. first look for the process id and then send the command.
root@jstc:/etc/init.d# ps -def | grep mongodmongodb 723 1 48 May04 ? 6-22:23:53 /usr/bin/mongod --config /etc/mongodb.confroot 22035 22012 0 20:22 pts/2 00:00:00 grep --color=auto mongodroot@jstc:/etc/init.d# kill -SIGUSR1 723root@jstc:/etc/init.d# cd /home/mongodb/log/root@jstc:/home/mongodb/log# lsmongodb.log mongodb.log.2014-05-18T12-23-51root@jstc:/home/mongodb/log# ls -alhtotal 20Gdrwxrwxrwx 2 root root 4.0K May 18 20:23 .drwxrwxrwx 4 root root 4.0K Apr 20 21:25 ..-rw-r--r-- 1 mongodb nogroup 34K May 18 20:24 mongodb.log-rwxrwxrwx 1 mongodb nogroup 20G May 18 20:23 mongodb.log.2014-05-18T12-23-51
Now you can move or delete the previous 20 GB log files.
You can also run a scheduled script to regularly send commands to the mongod service.