To create a backup of my mongo database, I am trying mongodump from my meteor console. The command successfully completes, but creates an empty folder under the dump folder. I use the command
mongodump -h 127.0.0.1 --port 3001 -d meteor
So basically I am trying to backup my database for reactionecommerce. My question is how to backup a meteor mongodb that is running locally? Thanks for any guidance of help.
The issue was with the mongo version 2.6.10. I installed the latest 3.4.4 in my Ubuntu 64 machine following the instructions https://docs.mongodb.com/master/tutorial/install-mongodb-on-ubuntu/ Now I am able to dump the data without any problem.
Related
I got an application from my developer and he asked me to host it over intranet. When i try to host it from virtual machine(cloud server), the mongo db data are missing from the collections.
Steps followed to host a site:
Copied the nodejs application folder from local to virtual machine.
Gave ng build followed by NPM start.
Now the mongodb connection is opened and able to see my database but the collections are empty.
Can anyone suggest me how to backup/copy the mongo db data from local to VM?
Thanks in advance
I think MongoDB backup/restore will help
https://docs.mongodb.com/manual/tutorial/backup-and-restore-tools/
from your local
mongodump --archive=test.20150715.gz --gzip --db test
move the backup file to your VM then run:
mongorestore --archive=test.20150715.gz --db test
I need to know how can dump the mongo db database locally using meteor.The database 'test' resides the folder name 'reaction' is dumping to another folder in same drive.How it is possible?Please help.Thanks in advance
In order to dump the database use the command
mongodump -h 127.0.0.1 --port 3001 -d meteor
After issuing this command a new folder "dump" will be created with your data.
I was using MongoDB on localhost of my Ubuntu (just for education purpose), but now, I have a new computer. So, I would like to have this collection on my new PC. What files do I need to copy to do this after installing MongoDB on a new machine ?
Thank you.
First you must read mongo backup and restore this documentation explain how to backup your data base and restore.
Now you should follow this steps :
1> From your old Ubuntu systems takes back up of your DB using following command
mongodump --host DB name --port 27017 --out /path to save your files
this command write data in BSON format, if you want to take only some collections from your DB then use mongodump --collection your collection name --db DB name
2> Now copy all above BSON files to your new PC and use following command to restore your old Ubuntu systems DB.
mongorestore --port <port number> <path to the backup>
before running this command you must install mongoDB.
My client wants to be able to dump the DB and also import, if need be, from within the app. Is this possible?
Thanks.
[EDIT]
I need to execute this in javascript. The client wants to be able to click a button in the app to export the DB.
Yes you can do this
If your app is running (locally on port 3000, add 1 to the port) it will dump to a directory called dump in your current working directory.
mongodump --port 3001
You can also restore the same way, from within the dump directory of the database you're looking to restore (usually meteor)
mongorestore --port 3001 --db meteor ./meteor
Keep in mind to use these tools you need mongodump and mongorestore installed. On mac you can install them with homebrew (mac) or aptitude (ubuntu)
So I have been playing around with meteor and mongodb and have a working version set up on my localhost. Unfortunately, when I do meteor deploy xxx.meteor.com it doesn't deploy my database as well.
How do I do this?
Meter deploy only deploys a fresh database. To copy over your data you have to use mongorestore with your local mongodb dump, which you can make with mongodump (docs)
So first dump your database somewhere
mongodump --host localhost:3002
Get your mongodb`s credentials by running (in your project dir):
meteor mongo myapp.meteor.com --url
This will give you your database details in the form:
mongodb://username:password#host:port/databasename
Then you can plug these into mongorestore (docs) and restore your local database over
mongorestore -u username -p password -h host:port -d databasename ~/desktop/location_of_your_mongodb_dump