Server-to-server Mysql Database Synchronization (VPS)

Asked

Viewed 665 times

2

I would like to synchronize my databases that are hosted between 3 different VPS, I would like to synchronize this data in real time when a record is changed in a database in a given VPS automatically changes in the other databases in the other VPS (I program in Delphi and accept tips anyway thank you very much) just remembering that the VPS servers have fixed Ip

  • You want to sync only the data or want to keep a copy of data and structure?

  • sync only the data Example = I have the 3 VPS and in each I limit the access of users to 100 people per database in each VPS or 3 banks to synchronize the data 300 people will access the same data in 3 VPS want to do this to limit the VP overloadLet’s say so when a VPS has 100 users the program redirects to the other bank that is synchronized with the 3 and real time

  • In the other 2 there would be need for reading and writing?

  • Oh ta I don’t know because I want to turn 3 VPS with 1 database each to sync to work with if Foce a single bank

  • But these databases will have different data and should synchronize among themselves? I’m afraid that’s not possible.

  • You need a load Balancing, so you can distribute the load between the 3 servers.

  • They will have the same structures and the same data I want to synchronizelos para quando algo algo for altera no banco 1 da VPS 1 o banco 2 da VPS 2 e o banco 3 e VPS 3 tinha a mesma informação alterado no banco 1 da VPS 1 e vise versa para que eles trabalhar com um só para que nem um banco/VPS sobrecarregue com muitas pessoas acessando

  • 1

    This would also help me if for some reason a VPS drops I have 2 more with the same data so that my application does not get out of AR

  • I posted an answer, you will have to analyze which shape best suits your project. There is no very simple way to do this "plug-in-play" type, not even the most correct one. Instead of having 3 VPS you could have a dedicated one with SSD or RAID for a better performance for example. Everything will depend on your project.

Show 4 more comments

1 answer

1


Mysql has some replication resource however it is necessary to understand the scope of your project to know which fits best.

The Mysql Replication allows data from a Mysql database server (the master) to be copied to one or more Mysql database servers (the slaves). Replication is asynchronous by default; slaves do not need to be permanently connected to receive updates from the master. Depending on the configuration, you can replicate all databases, selected databases or even selected tables within a database.

Another resource is Mysql Cluster, this allows to be configured for High availability (fault tolerance due to unavailability) and Scalability (expandable capacity and performance). It has a more complex configuration but more robust and with a very rich documentation to support, if you have time to study and implement this technique.

For your specific case, I think a replication configuration along with a load balancing server would solve. I have already made a setup using the following tutorial:

  1. Set up a Master-to-Master replication (in English)
  2. How to use haproxy to set up a Balancing load for mysql (English)

You could use the first VPS to install haproxy, with a mysql instance running on localhost only (haproxy will access locally) And with the other 2 VPS also in load balancing.

  • Thank you very much Leonancarvalho that’s exactly what I wanted you help me very much worth the attention :)

  • If the answer solves your problem, you can mark it as correct and give a vote to make it top. We are here to help and learn.

  • https://answall.com/help/accepted-answer

Browser other questions tagged

You are not signed in. Login or sign up in order to post.