Reputation: 133
I have a primary mysql server and 2 slaves as backups.
One of the slaves has been outfitted with solid state storage and due to this is used heavily for reporting.
Some of the data generated takes some time (around half an hour to an hour in some cases) and uses and generates allot of data (on the order of a couple gigs, which makes me hesitant to use transactions). The reporting tables are but a small subset of the total database so fully shutting down replication is somewhat out of the question.
The issue at hand is reports generated while the data is being generated are obviously incomplete and wrong.
Upvotes: 3
Views: 3515
Reputation: 44343
Try the following
You could try the following:
Step 01) On the Master, run this
FLUSH TABLES WITH READ LOCK; SELECT CONNECTION_ID(); SELECT SLEEP(300);
Step 02) SHOW SLAVE STATUS\G
on both Slaves (or just the Reporting Slave)
Step 03) Repeat Step 02 Until
At this point, since both Slaves have not received any new SQL to process, you have effectively frozen MySQL on the Slaves at the Same Point-In-Time as the Master
Step 04) On the Slaves (or just the Reporting Slave), run STOP SLAVE;
Step 05) On the Master, (if the CONNECTION_ID() return 789) run mysql> KILL 789;
in another mysql session.
Step 06) Run your reports
Step 07) Run START SLAVE;
on the Slaves (or just the Reporting Slave)
Since this seems a little heavy handed for the sake of a few tables in one particular schema, the simplest thing would just be to run STOP SLAVE;
on the Slave you do the Reporting from.
Upvotes: 2