mardi 24 février 2015

INSERT from SELECT with partly replicated tables on mySQL servers


I am operating a datawarehouse and would like to separate the processing from the front-end database.


The idea was that a Master is doing the number crunching and then replicates the tables to a Slave, where the front-end access is done.


Master (databases): datawarehouse temp archive



binlog_do_db = datawarehouse
innodb_flush_log_at_trx_commit = 1
sync_binlog = 1
binlog_ignore_db = temp
binlog_ignore_db = archive


Slave (databases) datawarehouse


So on the master I am running some imports into the temp database (which is not repliated), crunch some numbers on it, and then run



SELECT INTO datawarehouse.table FROM temp.table


I am aware that it only replicates when I connect to the datawarehouse DB and does not replicate when I connect to the temp DB.


I can also see the statements in the bin-log, so it is trying to replicate the data. Given that the temp.* is not on the Slave server, datawarehouse.table is empty on the slave.


I did insert some values manually and those values are present at the slave



INSERT INTO datawarehouse.table VALUES (...)


So it seems when I run the SELECT datawarehouse.table INTO FROM it doesnt replicate the 'data' which is inserted into the table, but only replicates the statement.


This doesn't really help as it would not reduce the load on the Slave, which was the purpose of this exercise.


Is there a way around this to force mySQL to replicate the data - not the statements, or any other solutions to my problem? importing/exporting might work but would be a pain.


Thank you





Aucun commentaire:

Enregistrer un commentaire