Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

Client switchover in mongodb replica

$
0
0

i just created the Mongodb replica system. On client side, i am connection using nodejs with the help of mongodb npm package.

I have 3 machines

  1. Machine1IP (Primary) //can read and write
  2. Machine2IP(Secondary) //can only read
  3. Machine3IP(Secondary) // can only read

and in nodejs script i am using

var url = 'mongodb://Mahcine1IP:27017/test';

to connect to mongo server. During the failover, Primary which is Machine1IP goes down and Machine 2 becomes primary lets say. In that case i need to replace the Machine1IP to k. My question is How would the client know that the failover has occured and it needs to change the server and how to change the server automatically in nodejs script?????


Viewing all articles
Browse latest Browse all 17268

Trending Articles



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