Database Reference
In-Depth Information
mongoDb's repair is a brute-force option. it attempts to repair and rebuild your data structures and indexes.
it does this by attempting to read and then rebuild the entire data structure from disk. if possible, you should attempt to
recover from backup; repairDatabase() should only be used as a last resort.
Warning
Compacting a Collection's Datafiles
Because of the way MongoDB allocates datafiles internally, you can run into what's colloquially known as “Swiss
cheese,” meaning that small empty sections of data storage space are left in the on-disk data structure. This can be
a problem as it means there are large sections of your datafiles being unused. While a repair to rebuild your entire
data structure may help, there can be other unintended consequences. The compact command will defragment and
restructure the data structure for a given collection within the existing datafiles, but it will not recover disk space.
$mongo
>use blog
> db.runCommand({compact:"posts"})
{ "ok" : 1 }
Upgrading MongoDB
Occasionally, new versions of MongoDB require you to upgrade the format of the database files. The team at
MongoDB, Inc. are aware of the impact (including the resulting downtime) caused by running an upgrade on a
running production service; however, there are times when the need to support heavily demanded new features
requires that an upgrade take place.
it is essential that you make a complete backup of your data before attempting any upgrade process.
in addition to this, you should always review the release notes, which are available at
http://docs.mongodb.org/manual/release-notes/ .
Warning
MongoDB's developers try to anticipate every possible problem that will present itself during an upgrade;
nevertheless, you must take steps to protect yourself as well. Upgrades will typically rewrite every piece of
data in your system in a new format, which means that even the slightest problem with the process can have
disastrous consequences.
The following list walks you through the proper steps required to upgrade a database server:
1.
Back up your data and make sure that the backup is viable. If possible, restore the backup
to another server and verify that it's OK.
2.
Stop your application or divert it to another server.
3.
Stop your MongoDB server.
4.
Upgrade the code of your MongoDB server to the desired version.
5.
Use the shell to perform initial sanity checks on the data.
6.
If anything looks suspicious, use the validation tools to check the data.
 
 
Search WWH ::




Custom Search