MongoDB log is too large a workaround

Source: Internet
Author: User
Tags install mongodb

MongoDB's log growth is fast,/Var space is immediately full, even if you change to another disk partition to save the log, the log is growing fast, the disk to see the chime.

A good way to do this is to use a rotational log.

MongoDB rotation Log a bit strange , the Linux mongd service accepts a KILL-SGIUSR1 command immediately renames the current log file to a file with a date, and then creates a new log file.

You can configure a rotation policy if you do not want a general rotation log. However, after testing, sending the command will not affect MongoDB's service.

Here is an example of finding the process ID and then sending the command.

[Email protected]:/etc/init.d# ps-def | grep Mongod
MongoDB 723 1 May04? 6-22:23:53/usr/bin/mongod--config/etc/mongodb.conf
Root 22035 22012 0 20:22 pts/2 00:00:00 grep--color=auto Mongod
[Email protected]:/etc/init.d#KILL-SIGUSR1 723
[Email protected]:/etc/init.d# cd/home/mongodb/log/
[Email protected]:/home/mongodb/log# ls
Mongodb.log mongodb.log.2014-05-18t12-23-51
[Email protected]:/home/mongodb/log# Ls-alh
Total 20G
drwxrwxrwx 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 20:24 Mongodb.log
-RWXRWXRWX 1 MongoDB nogroup 20G may 20:23 mongodb.log.2014-05-18t12-23-51

Official documents:

http://docs.mongodb.org/manual/tutorial/rotate-log-files/

You can now move or delete the log files for the previous 20G.

You can also make a regular script on your own and send commands to the Mongod service regularly.

Linux under Set MongoDB boot self-boot http://www.linuxidc.com/Linux/2011-07/39149.htm

CentOS Compile Install MongoDB http://www.linuxidc.com/Linux/2012-02/53834.htm

CentOS compilation installs MongoDB with MongoDB PHP extension http://www.linuxidc.com/Linux/2012-02/53833.htm

CentOS 6 uses Yum to install MongoDB and server-side configuration http://www.linuxidc.com/Linux/2012-08/68196.htm

Ubuntu 13.04 under Install MongoDB2.4.3 http://www.linuxidc.com/Linux/2013-05/84227.htm

MongoDB entry must read (both concept and actual combat) http://www.linuxidc.com/Linux/2013-07/87105.htm

The MongoDB authoritative guide (mongodb:the definitive) English language version [PDF] Http://www.linuxidc.com/Linux/2012-07/66735.htm


MongoDB log is too large a workaround

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.