Reputation: 3414
I have an app developed using meteor.js; since locally it is ok, I would like now to move it to my dedicated server; I've installed mongodb 2.6 on the server following official doc; I've made a dump of my local app's db by using:
mongodump -h 127.0.0.1 --port 3001 -d meteor
and uploaded the dump folder to /var/www/mywebsite on my server;
mongodb is configured to use auth: true;
trying
mongorestore -h 127.0.0.1 --port 27017 -d mydbname dump/meteor
nothing is inserted (using mongo shell as root, the only databases I can see are local and admin)
my root mongodb user is created on admin db: (i've tried also):
mongorestore -h 127.0.0.1 --port 27017 --username root --password xxxxxx -d mydbname dump/meteor
{
"_id" : "admin.root",
"user" : "root",
"db" : "admin",
"roles" : [
{
"role" : "userAdminAnyDatabase",
"db" : "admin"
}
]
}
I would like to have a mongo user for the new database and restore it; after trying some different things I realized I'm not understanding how to do... Somebody can help with this?
Upvotes: 0
Views: 430
Reputation: 6195
From this answer to how to mongoimport data to deployed meteor app? :
Dump data from existing mongodb (mongodb url: mongodb://USER:PASSWORD@DBHOST/DBNAME)
mongodump -h DBHOST -d DBNAME -u USER -p PASSWORD
This will create a "dump" directory, with all the data going to dump/DBNAME.
Get the mongodb url for the deployed meteor app (i.e. www.mymeteorapp.com)
meteor mongo --url METEOR_APP_URL
Note: the PASSWORD expires every min.
Upload the db dump data to the meteor app (using an example meteor db url)
mongorestore -u MY_REMOTE_DATABASE_USERNAME -p MY_REMOTE_DATABASE_USER_PASSWORD -h production-db-b2.meteor.io:27017 -db www_mymeteorapp_com dump/DBNAME/
All the data should get transferred!
Upvotes: 1