Keep your slave warm

note:
pt-query-digest 2.2.x had removed this function.

# pt-query-digest --version
pt-query-digest 2.1.9

workflow:
  +------+   filter select sql    +---------+    replay sql on slave    +-----+
 | master | -------------------> | text file |  ---------------------> | slave |
  +------+                        +---------+                           +-----+

steps:
1. capture select statement on master server, and save result into text file.

pt-query-digest --charset=utf8 --processlist h=172.30.0.1,u=user,p='xxxxx',P=3306,D=books --interval=1 --runtime=30s --print --filter '$event->{arg} =~ m/^select/i' --print --no-report

2. replay select sql statement on slave server.

pt-query-digest --charset=utf8 master_select.log --execute h=172.30.0.2,P=3306,u=user,p='xxxxx',D=books --execute-throttle 70,30,5 --no-report --statistics



Compare to percona playback.
  playback is usefull for warm your server, but don’t run it on the production server,because playback will run both SELECT and DML queries.
read more:
  http://www.percona.com/doc/percona-playback/index.html
  https://archive.fosdem.org/2013/schedule/event/bp_hot_slave/attachments/slides/271/export/events/attachments/bp_hot_slave/slides/271/slides.pdf


你可能感兴趣的:(slave,warm)