On the MongoDB site here states that a elections occurs when primary becomes unavailable. What happens if there is a disk read/write error on the primary node? Does heartbeat check covers disk health, system load or other checks or just covers connectivity?


It depends on exactly what you mean when you talk about a disk read / write error. If the error is that the data db volume is read-only or unmounted (e.g. An EBS is removed from a running EC2 instance) from a MongoDB primary will not trigger an election process as long as the mongod primary remains running and is exchanging heartbeats, then no failover will occur. The primary will not accept writes but it will not step down in this situation.

The heartbeat checks connectivity between members within the replica set and you can look at the code for it here. It is sent every 2 seconds and will timeout after 10 seconds.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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