I found this confusing at first too.
Rob.
Hi folks,
I'm having some trouble creating a custom write concern using tags in 2.0.7 and 2.2.0, I get the following error:
"errmsg" : "exception: mode { dc: 2.0 } requires 2 tagged with dc, but only 1 with this tag were found",
However, there is more than 2 dc tags in the config:
rs_intg:PRIMARY> rs.conf()
{
"_id" : "rs_intg",
"version" : 9,
"members" : [
{
"_id" : 0,
"host" : "mongo-test01v:27017",
"tags" : {
"dc" : "p"
}
},
{
"_id" : 1,
"host" : "mongo-test02v:27017",
"tags" : {
"dc" : "p"
}
},
{
"_id" : 2,
"host" : "mongo-test03v:27017",
"tags" : {
"dc" : "p"
}
},
{
"_id" : 3,
"host" : "mongo-test04v:27017",
"priority" : 0,
"hidden" : true,
"tags" : {
"backup" : "b"
}
}
]
}
Trying to create the write concern:
rs_intg:PRIMARY> cfg = rs.conf()
...
rs_intg:PRIMARY> cfg.settings = { getLastErrorModes : { production : { dc: 2 } } }
{ "getLastErrorModes" : { "production" : { "dc" : 2 } } }
rs_intg:PRIMARY> rs.reconfig(cfg)
{
"errmsg" : "exception: mode { dc: 2.0 } requires 2 tagged with dc, but only 1 with this tag were found",
"code" : 14831,
"ok" : 0
}
But if I set it to 1, then it works:
rs_intg:PRIMARY> cfg.settings = { getLastErrorModes : { production : { dc: 1 } } }
{ "getLastErrorModes" : { "production" : { "dc" : 1 } } }
rs_intg:PRIMARY> rs.reconfig(cfg)
{ "ok" : 1 }
The status appears to be ok:
rs_intg:PRIMARY> rs.status()
{
"set" : "rs_intg",
"date" : ISODate("2012-10-13T00:27:21Z"),
"myState" : 1,
"members" : [
{
"_id" : 0,
"name" : "mongo-test01v:27017",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 182,
"optime" : {
"t" : 1350087984000,
"i" : 1
},
"optimeDate" : ISODate("2012-10-13T00:26:24Z"),
"lastHeartbeat" : ISODate("2012-10-13T00:27:20Z"),
"pingMs" : 0
},
{
"_id" : 1,
"name" : "mongo-test02v:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 182,
"optime" : {
"t" : 1350087984000,
"i" : 1
},
"optimeDate" : ISODate("2012-10-13T00:26:24Z"),
"self" : true
},
{
"_id" : 2,
"name" : "mongo-test03v:27017",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 152,
"optime" : {
"t" : 1350087984000,
"i" : 1
},
"optimeDate" : ISODate("2012-10-13T00:26:24Z"),
"lastHeartbeat" : ISODate("2012-10-13T00:27:20Z"),
"pingMs" : 1
},
{
"_id" : 3,
"name" : "mongo-test04v:27017",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 126,
"optime" : {
"t" : 1350087984000,
"i" : 1
},
"optimeDate" : ISODate("2012-10-13T00:26:24Z"),
"lastHeartbeat" : ISODate("2012-10-13T00:27:20Z"),
"pingMs" : 0,
"errmsg" : "syncing to: mongo-test02v:27017"
}
],
"ok" : 1
}
Any suggestions appreciated, thanks!
cs