Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mongorestore, from meteor production server to local

Tags:

I've found plenty of good instructions on how to use mongodump and mongorestore, to back up my meteor production server and restore the backup if need be:

meteor mongo --url myApp.meteor.com  mongodump -u client -h production-db-b2.meteor.io:27017 -d myApp_meteor_com -out dump/2014_10_21 -p [password from meteor mongo --url]  mongorestore -u client -h production-db-b2.meteor.io:27017 -d myApp_meteor_com dump/2014_10_21_v2/myApp_meteor_com -p [password from meteor mongo --url] 

What I haven't found is an explanation of is how to restore a backup-dump to my local meteor app. I have a mongodump output in my app folder. I'm not sure if I can use mongorestore or if there's something else I'm supposed to be doing.

like image 756
Raemon Avatar asked Oct 21 '13 21:10

Raemon


1 Answers

The easiest way that I found:

  1. cd in your project and execute meteor command
  2. in another terminal:

mongorestore -h 127.0.0.1 --port 3001 -d meteor dump/meteor

change 127.0.0.1 if your localhost has different ip address and 3001 to a port you have mongodb on (it is usually 3001 or 3002, so try both), dump/meteor is the path to a dump you created previously.

Also the easiest way to export local db:

  1. cd in your project and execute meteor command
  2. In another terminal:

mongodump -h 127.0.0.1 --port 3001 -d meteor

again, change localhost ip and port if needed. . As a result, the dump/meteor folder with db files will be created in the folder you cd before running mongodump.

Good luck.

like image 69
Alex Alexeev Avatar answered Sep 22 '22 18:09

Alex Alexeev