Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

While using MongoDB to manage your network performance and configuration data you might need to move the server, back it up, restore data, etc.  There are many ways you can do this, and in this page we will describe one we used to move data from MongoDB on one server to another server.

This document will not describe details about MongoDB, it assumes some basic knowledge of MongoDB, but not much, for ; For details about MongoDB see http://docs.mongodb.org/.

Table of Contents

What Collections to Migrate

...

If you want to dump all collections in one go, simply omit the "-c somecollection" argument in the invocation below.

Code Block
/usr/local/mongodb/bin/mongodump -h kaos -d nmis -c customapps -o .

Once you know it is working, dump some more collections; the endpoints one in testing took a little while.

Code Block
/usr/local/mongodb/bin/mongodump -h kaos -d nmis -c sites -o .
/usr/local/mongodb/bin/mongodump -h kaos -d nmis -c reportConfig -o .
/usr/local/mongodb/bin/mongodump -h kaos -d nmis -c reportData -o .
/usr/local/mongodb/bin/mongodump -h kaos -d nmis -c sumCache -o .
/usr/local/mongodb/bin/mongodump -h kaos -d nmis -c command_outputs -o .
/usr/local/mongodb/bin/mongodump -h kaos -d nmis -c command_output_log -o .
/usr/local/mongodb/bin/mongodump -h kaos -d nmis -c endpoints -o .

...

To restore specific collections, run the following from the folder where the dumped BSON files are located:

Code Block
/usr/local/mongodb/bin/mongorestore -u opUserRW -p op42flow42 -d nmis -c customapps customapps.bson
/usr/local/mongodb/bin/mongorestore -u opUserRW -p op42flow42 -d nmis -c sites sites.bson
/usr/local/mongodb/bin/mongorestore -u opUserRW -p op42flow42 -d nmis -c reportConfig reportConfig.bson
/usr/local/mongodb/bin/mongorestore -u opUserRW -p op42flow42 -d nmis -c reportData reportData.bson
/usr/local/mongodb/bin/mongorestore -u opUserRW -p op42flow42 -d nmis -c sumCache sumCache.bson
/usr/local/mongodb/bin/mongorestore -u opUserRW -p op42flow42 -d nmis -c command_outputs command_outputs.bson
/usr/local/mongodb/bin/mongorestore -u opUserRW -p op42flow42 -d nmis -c command_output_log command_output_log.bson
/usr/local/mongodb/bin/mongorestore -u opUserRW -p op42flow42 -d nmis -c endpoints endpoints.bson

...

Code Block
/usr/local/mongodb/bin/mongorestore -u opUserRW -p op42flow42 -d nmis .

...


Verify the Collections Exist

...