patternMinor
MongoDB failover reasons
Viewed 0 times
mongodbfailoverreasons
Problem
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
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
Solution
Here is what you can do to start
Run the following on the old
This will print the exact time
Run the following on the old
PRIMARYvar dt = new Date(db.serverStatus().localTime - db.serverStatus().uptime*1000).toString() ; dtThis will print the exact time
mongod was started.PRIMARY failover was triggered 2015-03-03T12:18:41.540-0500. - If
dtis close to2015-03-03T12:18:41.540-0500
mongodcrashed or was restarted
- Check the
mongodLog File on the oldPRIMARYfor that same timeframe
- If
dtis not close to2015-03-03T12:18:41.540-0500
mongodis still running fine
- The old
PRIMARYsimply became unreachable
- Check network logs along port 27017
Code Snippets
var dt = new Date(db.serverStatus().localTime - db.serverStatus().uptime*1000).toString() ; dtContext
StackExchange Database Administrators Q#94485, answer score: 3
Revisions (0)
No revisions yet.