Saturday, October 22, 2011

Copying MongoDB data from your machine to the cloud


For this example I’ll be using MongoHQ as the cloud host. I prefer MongoHQ over MongoLab because the web interface actually lets you edit and manage your data, which is great for making quick small tweaks.

Step 1 - Create a new database in MongoHQ

I start with a Free 16 MB collection. The next page you’re taken to shows you the address for the database and will look something like staff.mongohq.com:10023/DbName

Step 2 - Create a Database User

Click on the Database Users tab and add a user. Leave the Read Only boxed unchecked.

Step 3 - Prep your local data for transfer

On your machine open a command prompt and navigate to your Mongo bin directory or wherever the mongo.exe file is located.
Type mongodump -d DatabaseName where DatabaseName is the actual name of your database 
There will be a new folder in the directory named dump and in there another folder named after your database.

Step 4 - Transfer the data to the cloud

Type mongorestore -h staff.mongohq.com:10023 -d DatabaseName -u admin -p password C:\Mongo\dump\DatabaseName (Make sure to substitute the appropriate values).
Verify on MongoHQ’s collections tab that the data was transferred successfully.

3 comments:

  1. Creative engineering reflected in this tool, mfcmapi offers specialized Outlook mailbox inspection capabilities for technical users. Browsing remains structured, tools feel advanced, and every feature contributes toward precise system analysis.

    ReplyDelete
  2. Fantastic productivity support offered by this software, deskpins allows users to manage window focus effortlessly. Everything feels lightweight, navigation remains simple, and every feature contributes to a more organized desktop experience.

    ReplyDelete
  3. Seamless integration utility offering robust dshidmini enables precise controller input control for gaming enthusiasts ensuring smooth responsiveness and accurate mapping across multiple devices while supporting stable configurations during long play sessions reliably making overall user experience extremely stable today always

    ReplyDelete