0

I am wanting to log a public chat to a database to be able to lookup chat history in the future. I am familiar with node.js and mongoDB.

I don't want to miss logging any chat messages, and so was looking for a redundant solution in case of network disconnect or server failure/restarts.

Everything I've seen regarding failover and balancing, is with the node app as a http server, and so can be solved with a reverse proxy sending the requests to the different servers.

But I'm at a loss as how to have 2+ VPSs in different regions, running a node app that monitors the same public chat and logs those chat entries to a DB without race conditions on the DB.

Messaging between the node instances? But it seems like there would also be race conditions with that...

Thanks for the help.

DBKynd
  • 1
  • Questions asking us to **recommend or find a book, tool, software library, tutorial or other off-site resource** are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, [describe the problem](http://meta.stackoverflow.com/questions/254393) and what has been done so far to solve it. – Neil Lunn Jul 05 '17 at 23:52
  • possible duplicate of [best practice for data synchronization in nodejs](https://stackoverflow.com/questions/40559554/best-practice-for-data-synchronization-in-nodejs) – Paul Sturm Jul 06 '17 at 00:05
  • The usual scheme for two geographically separate servers for fail-over reasons would be to have the client connected to one and then failover to the other if the first one goes down. If you are going to have duplicate database servers also, then you need to set up two database servers for continuous synchronization so that when one takes over for the other in a fail over situation, it has a current copy of the data from the other one. You typically do not want to have one client talking to two separate servers, putting the burden on the client to keep both servers up-to-date. – jfriend00 Jul 06 '17 at 00:44

0 Answers0