Search code examples
mongodbshardingmongodb-replica-set

mongos can't write to replica set config server (CSRS) (invalid write concern)


I'm setting up a sharded mongodb, largely per https://docs.mongodb.com/manual/tutorial/deploy-shard-cluster/. When I start the mongos instance, I get a stream of errors along the lines of

getLastError command failed: w: 'majority' is the only valid write concern
when writing to config server replica sets, got: { w: 1, wtimeout: 0 }

I believe this is because a config server replica set requires a {w:majority} write concern but for reasons unclear mongos is generating writes with {w:1}. Have looked everywhere and found no answers; the closest thing I've seen is https://jira.mongodb.org/browse/SERVER-20945 but that's in the version I'm running so doesn't seem to be the answer.

Because the config server is essentially un-writeable, that prevents creating the shards and so forth, rendering the whole thing inoperable.

It's mongos v 2.6.12 and mongo v 3.2.6.

Thanks in advance for any help.


Solution

  • Per https://jira.mongodb.org/browse/SERVER-24385, the issue here is the difference in version between mongos and mongod. The earlier mongos version doesn't play well with the newer mongod due to changes in how config servers work. So the answer is, don't mix (major) versions of the two.