Mysql – Data Warehousing strategy

MySQL

I have a busy MySQL database with 1.6 million records a day, I'm looking to replicate this data to another server, then run a clean up job on production database to maintain small database in production.

I thought about Master / Slave setup, but I'm not sure how can I prevent deletes from replicating to slave.

I'm sure other BD admins / developers have run into same situation, I would appreciate any suggestion / recommendation

Thank you

Best Answer

I thought about Master / Slave setup, but I'm not sure how can I prevent deletes from replicating to slave.

You can't do that. Replication is intended to replicate as much as possible to keep the slaves as accurate copies of the master(s).

You might want to replicate to another machine so that you can have a copy to run the copy-to-archive archive process on, so that this does not impact performance of the application when being run, but that is optional (and not necessary if the process doesn't impact live performance much or you have a time window in which you don't care if it does (i.e. over-night if your application is predominantly used in one timezone so you have quiet periods when most users are sleeping)).

The most efficient way to update the archive/reporting database from the production one (either the main DB or a read-only replica), and clean up production once this is done, depends a lot on the structure of your data.