A
A
Andrey Rumm2012-12-28 12:26:17
MySQL
Andrey Rumm, 2012-12-28 12:26:17

Replication of data of several tables in two independent databases in one direction

Good day!
There are two independent databases with the same structure. It is required to replenish the first database with the data of selected tables from the second database.
As a matter of fact it is required to replicate the data of the second DB in the first and all.

As far as I understand, 2 independent bases require master-master replication. But replication is one-way. Therefore in a configuration of the first server it is required to put in ignoring of replication of all tables or a DB?
Correct me if I'm wrong.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
@
@mgyk, 2012-12-28
_

You can work with replication here only if you are sure that no keys will intersect, and besides this, what will you do if at some point it gets up, and then it will be completely incomprehensible which part of the data comes from.
Do better with a script, something like
1) SELECT * FROM A.T1 into outfile 'backup-XXXX';
2) SELECT * FROM B.T1 into outfile 'update-XXXX';
3) LOAD DATA INFILE 'update-XXXX' into A.T1;
If you need everything online, then it is better to do it at the application level, so that data is added to all the plates at once. It will be easier to catch errors there.

S
subvillion, 2012-12-28
@subvillion

It is possible to replicate tables, it is possible in master-master mode, but initially the data in the tables must be the same. Either empty or one dump. Because changes in the database are written to the binary log of the master and then reproduced on the slave, in your case, existing data from B will never get into A, only new records after replication is enabled. And vice versa.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question