Created
February 1, 2017 13:23
-
-
Save niczero/3a0b5c4677a084e239613a46a76bd161 to your computer and use it in GitHub Desktop.
Quiesce a MySQL database (eg for hot rsync)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
perl -MMojo::Base=strict -MMojo::Util=spurt | |
-MMojar::Mysql::Connector=cnf,/home/me/.mysql/super_production-02.cnf | |
-E'my $d = Mojar::Mysql::Connector->new->connection; | |
$d->do(q{FLUSH LOGS}); | |
my $unquiesce = $d->quiesce; | |
spurt $$ => q{/tmp/quiesced}; | |
say q{Quiesced!}; | |
while (-f q{/tmp/quiesced} and $d->ping) { | |
say join q{ | }, $d->selectrow_array(q{SHOW MASTER STATUS}); | |
sleep 30 | |
} | |
$unquiesce->()' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
perl -MMojo::Base=strict \ | |
-MMojar::Mysql::Connector=cnf,/home/me/.mysql/super_production-02.cnf \ | |
-E'my $d = Mojar::Mysql::Connector->new->connection; | |
$d->global_var(innodb_max_dirty_pages_pct => 80); | |
say $d->global_var(q{innodb_max_dirty_pages_pct})' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment