imooc:PRIMARY> rs.add({_id:1,host:"192.168.65.129:28002"})
{
"operationTime" : Timestamp(1540203228, 1),
"ok" : 0,
"errmsg" : "Our config version of 2 is no larger than the version on 192.168.65.129:28002, which is 2",
"code" : 103,
"codeName" : "NewReplicaSetConfigurationIncompatible",
"$clusterTime" : {
"clusterTime" : Timestamp(1540203228, 1),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
}
}
imooc:PRIMARY> rs.add({"192.168.65.129:28002"})
2018-10-22T18:26:02.800+0800 E QUERY [js] SyntaxError: missing : after property id @(shell):1:30
imooc:PRIMARY>
请问老师 这个命令应该怎么写呀
rs.add("192.168.65.129:28002") 去掉大括号,或者 rs.add({host: "192.168.65.129:28002"})
这是配置版本的问题,应该是配置的版本小于了原有的版本号导致的,每配置一次版本号会加一。