Restore a mongodb in meteor production server

前端 未结 2 2045
鱼传尺愫
鱼传尺愫 2020-12-30 17:03

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 mongorestor

相关标签:
2条回答
  • 2020-12-30 17:29

    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.

    0 讨论(0)
  • 2020-12-30 17:42

    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).

    0 讨论(0)
提交回复
热议问题