更改副本集的主从结点时,主结点降低优先级的操作报错了
不知道要怎么切换了
itcast:PRIMARY> cfg.members[1].priority=0
0
itcast:PRIMARY> rs.reconfig(cfg)
{
"operationTime" : Timestamp(1685451355, 1),
"ok" : 0,
"errmsg" : "This node, nosql02:27017, with _id MemberId(1) is not electable under the new configuration with {version: 10, term: 11} for replica set itcast",
"code" : 104,
"codeName" : "NodeNotElectable",
"$clusterTime" : {
"clusterTime" : Timestamp(1685451355, 1),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
}
}
试了把副结点的优先级提高,超过主结点也报错
itcast:PRIMARY> cfg.members[0].priority=4
4
itcast:PRIMARY> rs.reconfig(cfg)
{
"operationTime" : Timestamp(1685451705, 1),
"ok" : 0,
"errmsg" : "This node, nosql02:27017, with _id MemberId(1) is not electable under the new configuration with {version: 10, term: 11} for replica set itcast",
"code" : 104,
"codeName" : "NodeNotElectable",
"$clusterTime" : {
"clusterTime" : Timestamp(1685451705, 1),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
}
}