Meteor: how can I back up my mongo database?

How can I backup my meteor mongo database?

If I run:

meteor mongo 

mongodump command does not work inside meteor mongoshell

+51
import mongodb dump backup meteor
May 29 '13 at 14:37
source share
2 answers

First you need to deploy a meteor.

Then if you run

 meteor mongo 

you will get the result something like this:

MongoDB Shell Version: 2.2.1

connection to: 127.0.0.1∗001/meteor

The Meteor db host is at 127.0.0.1 with port 3001. Exit the mongo shell and use mongodump from your terminal.

 mongodump -h 127.0.0.1 --port 3001 -d meteor 

Dumps will be located under the dump folder in the folder in which you executed the above command.

You can import your db back to the meteor with

 mongorestore -h 127.0.0.1 --port 3001 -d meteor dump/meteor 
+83
May 29 '13 at 14:37
source share

If you need to back up the meteorite application database deployed to meteor.com, follow these steps:

  • Make sure you log in to your meteor dev account and create a temporary connection link : $ cd yourapp $ meteor login $ meteor mongo yourapp.meteor.com --url

You will get something like:

 mongodb://client-ID:password-3be8-f6c5-50a9-password@production-db-b1.meteor.io:27017/yourapp_meteor_com 

This link expires in 1 minute, so hurry up! :)

  1. Create a backup using the mongodump command ( http://docs.mongodb.org/manual/tutorial/backup-with-mongodump/#backup-from-non-local ):

    $ mongodump -h production-db-b1.meteor.io --port 27017 --username client-ID --password password-3be8-f6c5-50a9-password -d yourapp_meteor_com

This is backing up the entire remote database to the default dump / folder. Voila!

  1. If you need to import db into the local meteor mongo database , run the mongo shell: $ meteor mongo MongoDB shell version: 2.4.9 connecting to: 127.0.0.1:3001/meteor {001/ $ meteor mongo MongoDB shell version: 2.4.9 connecting to: 127.0.0.1:3001/meteor

and in another terminal use the mongorestore command

$ mongorestore --port 3001

+22
Sep 25 '14 at 20:32
source share



All Articles