0

I had a mongodb with 4 shards, then I created another 4 sharded mongo instance in another server and configured replica sets, after that I got the bellow error when I want to query the first mongo (writing to db also fails!)

Error: error: {
"$err" : "setShardVersion failed shard: shard0001:127.0.0.1:27122 { errmsg: \"not master\", note: \"from post init in setShardVersion\", ok: 0.0, $gleStats: { lastOpTime: Timestamp 0|0, electionId: ObjectId('000000000000000000000000') } }",
"code" : 10429,
"shard" : "shard0001"}

I want to know what does \"not master\" means and what causes this error?

Regards.

Adel
  • 3,542
  • 8
  • 30
  • 31

1 Answers1

1

Mongo not allows writes to secondary server.

Mongo allows reads from secondaries by enabling slaveOK command

rs.slaveOk()

manual

profesor79
  • 9,213
  • 3
  • 31
  • 52