I have a replica set on MongoDB with 3 members – primary, secondary and arbiter. One day I came and saw that primary and secondary have switched. I'd like to find a reason for the failover that caused the elections. Please advise me how and where I can find what caused it. I looked in the logs and I found only this:
2015-03-03T12:18:41.540-0500 [rsHealthPoll] replset info
my_server:27017 thinks that we are down 2015-03-03T12:18:41.540-0500
[rsHealthPoll] replSet member my_another_server:27017 is now in state
PRIMARY 2015-03-03T12:18:41.540-0500 [rsMgr] stepping down; another
primary was elected more recently
Thanks
Best Answer
Here is what you can do to start
Run the following on the old
PRIMARY
This will print the exact time
mongod
was started.PRIMARY
failover was triggered2015-03-03T12:18:41.540-0500
.dt
is close to2015-03-03T12:18:41.540-0500
mongod
crashed or was restartedmongod
Log File on the oldPRIMARY
for that same timeframedt
is not close to2015-03-03T12:18:41.540-0500
mongod
is still running finePRIMARY
simply became unreachable