mysql - Replication slave locking -


i have primary mysql server , 2 slaves backups.

one of slaves has been outfitted solid state storage , due used heavily reporting.

some of data generated takes time (around half hour hour in cases) , uses , generates allot of data (on order of couple gigs, makes me hesitant use transactions). reporting tables small subset of total database shutting down replication out of question.

the issue @ hand reports generated while data being generated incomplete , wrong.

  1. what best way lock tables on both master , reporting server?
  2. would "lock tables" statement replicated slaves or best course of action generate data in temporary tables , copy them final table in 1 insert ... select statement.

try following

you try following:

step 01) on master, run this

flush tables read lock; select connection_id(); select sleep(300); 

step 02) show slave status\g on both slaves (or reporting slave)

step 03) repeat step 02 until

  • relay_log_space stops changing
  • relay_log_pos stops changing
  • seconds_behind_master 0

at point, since both slaves have not received new sql process, have frozen mysql on slaves @ same point-in-time master

step 04) on slaves (or reporting slave), run stop slave;

step 05) on master, (if connection_id() return 789) run mysql> kill 789; in mysql session.

step 06) run reports

step 07) run start slave; on slaves (or reporting slave)

update 2012-06-05 15:15 edt

since seems little heavy handed sake of few tables in 1 particular schema, simplest thing run stop slave; on slave reporting from.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -