4

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

1
  • Check any OS/network logs or monitoring tools to find out why the primary believed it was down. Commented Mar 5, 2015 at 15:03

1 Answer 1

3

Here is what you can do to start

Run the following on the old PRIMARY

var dt = new Date(db.serverStatus().localTime - db.serverStatus().uptime*1000).toString() ; dt

This will print the exact time mongod was started.

PRIMARY failover was triggered 2015-03-03T12:18:41.540-0500.

  • If dt is close to 2015-03-03T12:18:41.540-0500
    • mongod crashed or was restarted
    • Check the mongod Log File on the old PRIMARY for that same timeframe
  • If dt is not close to 2015-03-03T12:18:41.540-0500
    • mongod is still running fine
    • The old PRIMARY simply became unreachable
    • Check network logs along port 27017

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.