3

I'm trying to copy all the data from my localhost default meteor mongo database to the production server to use it in "app.meteor.com".

I tried to use mongorestore usinng the information provided by "meteor mongo --url app.meteor.com", but it does not modify any document. Moreover, when I connect to mongo database of the server, I can only read (find) documents. When i use update or insert functions it says "not master"

nsblenin
  • 237
  • 3
  • 12

2 Answers2

6

Run ~/meteor/meteor mongo -U yoapp

You will get something like this

mongodb://client:387shff-fe52-07d4-69a4-ba321f3665fe7@c0.meteor.m0.mongolayer.com:27017/yoapp_meteor_com

Take the values and put into mongorestore like this

mongorestore -u client -p 387shff-fe52-07d4-69a4-ba321f3665fe7 -h c0.meteor.m0.mongolayer.com:27017 -db yoapp_meteor_com /home/user/dump/yoapp

I just dumped a prod app to my local dev machine. Testing some new changes. Pushed code to a staging install on meteor.com and then used mongorestore to populate the staging database.

Steeve Cannon
  • 3,682
  • 3
  • 36
  • 49
0

Moreover, when I connect to mongo database of the server, I can only read (find) documents. When i use update or insert functions it says "not master"

It's probably because the server you are connecting to is not a MASTER, but a SLAVE in a replica-set. Slaves are readonly and all writes need to be directed to the master. You can get the master hostname:port by querying rs.conf() and looking at the entries in members. See http://docs.mongodb.org/manual/reference/replica-configuration/

Get the master and then try mongoimport/mongorestore on it.

You should also tail the mongod logs on your production server, to see if there are any errors on import (provided you have access).

Adil
  • 2,092
  • 3
  • 25
  • 35