I am creating this web application in Node.js and MySQL and I am struggling on data synchronisation.
Here's the scenario:
Suppose we have 1000 customers that all have a local webserver-database in their office/site. A user can login, edit data, datalog sensors, etc. All these activities contribute to, for the sake of the example, around 500KB of table data per day, per customer/site. So each of the 1000 customers have a local database that will always constantly get updated with new data many times in a day.
At the same time for all 1000 customers there is a cloud service that allows them to login and see what all of their data, as if they were locally present on-site. They can also make changes from the cloud, edit/create/delete data.
Now the issues I have are:
Every site needs to be bidirectionally synced with the cloud server. What do you recommend? (Multi-master replication?, Clustering?, write a custom one?) What are the pros-cons?
What about when the customer's site is offline and there are new data added to both the local database and also in the cloud one? How are conflicts and merging usually done?
Thanks in advance!