1
votes

I am trying to restore some collections to the replica server's db local.

I am gonna run some data on it. but I am getting errors. is there anyway around this?

mongorestore --db local /dumps/

ERROR: trying to write to non-master 127.0.0.1:27017 (127.0.0.1) isMaster info: { setName: "hosthost", setVersion: 2, ismaster: false, secondary: true, hosts: [ "mongo-replica.hosthost.com:27017", "mongo-temp:27017" ], primary: "mongo-temp:27017", me: "mongo-replica.hosthost.com:27017", maxBsonObjectSize: 16777216, maxMessageSizeBytes: 48000000, maxWriteBatchSize: 1000, localTime: new Date(1479528226168), maxWireVersion: 2, minWireVersion: 0, ok: 1.0 }

1

1 Answers

0
votes

One solution is to create a minimal replica set. One way to do this is to start a Mongo shell, type mongo at a shell prompt, then in the mongo shell type something like:

rs.initiate({ _id: "rs0", "members": [ { _id: 0, host: "localhost:27017"}]})

where "rs0" is the name of your single member replica set. After doing this your mongorestore should work.