Quantcast
Channel: Active questions tagged amazon-ec2 - Stack Overflow
Viewing all articles
Browse latest Browse all 29543

What happens when the primary node crashes and it is on a different host?

$
0
0

I have read Mongo Docs and some posts, but it's not clear enough to me. I don't understand how it works when Mongo is distributed on different hosts

I want to develop a cluster with replica sets (so an app can stand network and database issues) on different hosts (EC2 instances). Let's assume this scenario (based on this tutorial ):

Instance A: Primary node on 10.0.0.1

Instance B: Secondary node on 10.0.0.2

Instance C: Arbiter on 10.0.0.3

My app is working normal and is connected to A (the IP 10.0.0.1 is configured as an environment variable). Suddenly Mongo inside A crashes due to any reason, then Mongo does its stuff, and C chooses B as the new Primary. What will happen with my app that is connected to A? Does Mongo redirect to B automatically? What happens when the whole instance (A) is down? Do I need to add some additional code to handle this?

I have been working only with single mongo instance, but this time I want to do something bigger and more consistent, and this confuses me. I appreciate your answers.


Viewing all articles
Browse latest Browse all 29543

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>