我试图建立一个包含三个成员(其中一个是仲裁者)的副本集。由于技术原因,成员必须使用SSH隧道相互访问。我有理由相信这是正确配置的,就像在所有mongodb主机上一样,我可以通过提供相关的--host和--port参数使用mongo连接到其他节点。当我发起我希望成为主要副本的副本时,日志会显示"发起者"成功连接到其他成员:
REPL [ReplicationExecutor] transition to RECOVERING
REPL [ReplicationExecutor] transition to SECONDARY
REPL [ReplicationExecutor] Member 10.x.x.1:27017 is now in state STARTUP
REPL [ReplicationExecutor] Member 10.x.x.2:27017 is now in state STARTUP
REPL [ReplicationExecutor] Starting an election, since we've seen no PRIMARY in the past 10000ms
REPL [ReplicationExecutor] conducting a dry run election to see if we could be elected
然而,其他成员拒绝投票,因为他们没有任何配置副本集
REPL [ReplicationExecutor] VoteRequester: Got error processing response with status: BadValue: Unexpected field info in ReplSetRequestVotes, resp:{ info: "run rs.initiate(...) if not yet done for the set", ok: 0.0, errmsg: "no replset config has been received", code: 94 }
REPL [ReplicationExecutor] VoteRequester: Got no vote from 10.16.10.4:30000 because: , resp:{ info: "run rs.initiate(...) if not yet done for the set", ok: 0.0, errmsg: "no replset config has been received", code: 94 }
REPL [ReplicationExecutor] VoteRequester: Got error processing response with status: BadValue: Unexpected field info in ReplSetRequestVotes, resp:{ info: "run rs.initiate(...) if not yet done for the set", ok: 0.0, errmsg: "no replset config has been received", code: 94 }
REPL [ReplicationExecutor] VoteRequester: Got no vote from 10.16.10.4:27018 because: , resp:{ info: "run rs.initiate(...) if not yet done for the set", ok: 0.0, errmsg: "no replset config has been received", code: 94 }
REPL [ReplicationExecutor] not running for primary, we received insufficient votes
此过程会重复每个electionTimeoutMillis。
在副本集的intiator上运行rs.status()会给每个成员收到的最后一次心跳提供可疑时间
> rs.status()
...
"lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z")
...
我不确定这里的原因和结果。副本集的成员是否仅在"发起者"之后接收配置。收到了心跳反应?有没有办法强制启动器将配置发送给其他成员?