Mongod Database Repair __ Database

Source: Internet
Author: User
Tags log log mongodb mongodb documentation
To view the Mongodb.log log, the following statement is found in the log:
..............
Mon Mar 317:46:37 [conn148] Assertion:10295:getfile (): Bad file number value (corrupt db?): Run Repair
..............
Translated as: declaration: GetFile (): Incorrect file value (corrupted database. ): Run Repair

After checking the MongoDB documentation, the process is repaired using the following methods:

First stop the Mongod service, delete the Mongodb.log, or you can back up
# Rm-rf/data/mongodb/mongodb.log

Delete a MongoDB process file
# Rm-rf/mongodb/mongod.lock

To repair
#/usr/local/mongodb/bin/mongod--repair--dbpath/mongodb/--repairpath/mongodb/repair/
Temporary repair directory must be large, or there will be insufficient disk capacity to prompt, unable to repair

At this time the MONGODB process will be stored in the/mongodb/repair/directory temporary repair database files, the file directory is "$tmp _repairdatabase_0" so this directory space is large enough.
Production environment database is 100G, repair carried out for about 3.5 hours, in the "/mongodb/repair/$tmp _repairdatabase_0" directory generated nearly 30G of database temporary files, repair completed after the database temporary files automatically purged.

After opening the Mongod service, check the database, read and write normal, Mongodb.log no error occurred. Fix OK.

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.