...
Then dump a collection to a BSON file, if you have a user defined on this DB you will need to also use the following in the command line "-u opUserRW -p op42flow42"
Code Block |
---|
/usr/local/mongodb/bin/mongodump -h kaos -d nmis -c customapps -o . |
Once you know it is working, dump some more tables, 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 .
|
Importing a Collection
Now you have them on disk you can import them to another Mongo instance, this assumes you are going to import to a local DB and the NMIS database has been added and credentials set. From the same folder where the dumped BSON files are located run the following.
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 |
Verify they Collections Exist
Code Block |
---|
[root@nmisdev64 data]# mongo
MongoDB shell version: 2.4.1
connecting to: test
> use nmis
switched to db nmis
> db.auth("opUserRW","op42flow42");
1
> db.getCollectionNames()
[
"command_output_log",
"command_outputs",
"customapps",
"endpoints",
"reportConfig",
"reportData",
"sites",
"sumCache",
"system.indexes",
"system.users",
"trend"
]
> db.endpoints.count()
3203784 |
You can tell your Opmantek Apps to start using the new MongoDB instance.