您可以在日志(新“主”的)中找到以下行:
2018-08-02T03:56:49.817+0000 I REPL [ReplicationExecutor] Standing for election
2018-08-02T03:56:49.818+0000 I REPL [ReplicationExecutor] not electing self, ip-xxx-xxx-xxx-xxx.eu-west-1.compute.internal:27017 has same OpTime as us: { : Timestamp 1533182831000|1 }
2018-08-02T03:56:49.818+0000 I REPL [ReplicationExecutor] possible election tie; sleeping 445ms until 2018-08-02T03:56:50.263+0000
2018-08-02T03:56:50.263+0000 I REPL [ReplicationExecutor] Standing for election
2018-08-02T03:56:50.265+0000 I REPL [ReplicationExecutor] not electing self, ip-xxx-xxx-xxx-xxx.eu-west-1.compute.internal:27017 has same OpTime as us: { : Timestamp 1533182831000|1 }
2018-08-02T03:56:50.265+0000 I REPL [ReplicationExecutor] running for election; slept last election, so running regardless of possible tie
2018-08-02T03:56:50.265+0000 I REPL [ReplicationExecutor] received vote: 1 votes from ip-xxx-xxx-xxx-xxx.eu-west-1.compute.internal:27017
2018-08-02T03:56:50.265+0000 I REPL [ReplicationExecutor] election succeeded, assuming primary role
2018-08-02T03:56:50.265+0000 I REPL [ReplicationExecutor] transition to PRIMARY
你可以看到选举是在联合技术时间凌晨3点56分举行的。
我建议你用
less
在日志文件中搜索的工具:
less /var/log/mongodb/mongod.log
然后,在文件末尾使用
克
,然后使用
?
,并搜索
“竞选”
.