MongoDB solution to clean up the data disk is not released

mongodb not free hard disk space has been occupied, unless drop the entire library, there are two ways to free up disk space.
Method a:
enter the corresponding library performed in the shell mongodb db.repairDatabase()ordb.runCommand({ repairDatabase: 1 })

The disadvantage is that the time spent is not short, to ensure that the remaining amount of disk space, and when the repair database when the table is in the lock state, can neither read nor write
Method Two:
Import Export

mongodump --port 27017 -u root -p mypassword --authenticationDatabase admin -d test -o /backup

Into the implementation of the corresponding library in the shell mongodbdb.dropDatabase()

mongorestore --port 27017 -u root -p Manager --authenticationDatabase admin  -d test /backup/test

The disadvantage is the time when the library will take quite a lot longer

In fact, the above two methods are not recommended in a production environment, will affect the normal course of business, you can try the test environment, the production environment is not enough disk space is recommended to increase disk.

Guess you like

Origin blog.csdn.net/u014609263/article/details/94621316