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
Machine1IP
(Primary) //can read and writeMachine2IP
(Secondary) //can only readMachine3IP
(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?????