Adel
Adel

Reputation: 3733

Mongo "setShardVersion failed"

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.

Upvotes: 0

Views: 647

Answers (1)

profesor79
profesor79

Reputation: 9473

Mongo not allows writes to secondary server.

Mongo allows reads from secondaries by enabling slaveOK command

rs.slaveOk()

manual

Upvotes: 1

Related Questions