Reputation: 491
I have server-1 with node js and MongoDB installed, And I created server-2 from the snapshot of server-1 and I have created a load balancer and attached both servers, My question here is does MongoDB is copied each other suppose if server-2 goes down and all the traffic will be to Server-1 right, Once when server-2 is up the database content will be different between 2 servers right?
Upvotes: 0
Views: 46
Reputation: 200486
The database content will be different as soon as the next insert or update happens, since the load will be balanced between the two servers, each server will get 50% of the requests, so each server will have 50% of the changes on their own database.
You can't run MongoDB on each server like this in a load balanced environment. You would need to run MongoDB on a separate server that both NodeJS servers connect to.
Upvotes: 1