Replicate database taking into account possible changes in the source BD

1

Good day, I need to "replicate" some fields of some a database, the problem is that I must contemplate the fact that some data in the source DB are modified to update those in the new DB and not generate a new record. In my first load of data, I made use of a PHP file which makes the query of the required fields and inserts them in the new DB with an INSERT IGNORE (This works well to make the first data load), then I run into the problem that some values change at the source and the new system does not have the correct data.

    
asked by Alphalapz 13.11.2017 в 17:13
source

1 answer

0

MySQL has a very advanced and practical replication system but it seems that you want to do it by software. This I do NOT recommend; Data replication is something complex that a lot of people have been improving in MySQL for many years so I suggest using it.

Replication in MySQL can be Master-Slave, as usual, but it also supports double-master configurations if that's what you need (it's like a cluster for the poor).

Check out the MySQL replication manual here .

If it is what you want, you can only replicate some tables. In reality you would replicate a database but in the slave you can tell it what data you want to replicate, so you can replicate some data in one slave and others in another. You can see some of those options here .

    
answered by 13.11.2017 / 18:40
source