Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

Commit

Permalink
Add nice output for slow MySQL replication
Browse files Browse the repository at this point in the history
Importing the dump might take a while so this lets people know
what's going on.
  • Loading branch information
alexmuller committed Nov 6, 2015
1 parent f7d7dfd commit f85ccc3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mysql.py
Expand Up @@ -86,6 +86,10 @@ def replicate_slave_from_master(master):
run_mysql_command("STOP SLAVE")
run_mysql_command("SET GLOBAL slow_query_log=OFF")

with hide('running', 'stdout'):
database_file_size = run("stat --format='%s' dump.sql")

print('Importing MySQL database which is {0}GB, this might take a while...'.format(round(int(database_file_size) / (1024*1024*1024*1.0), 1)))
run('sudo -i mysql -uroot < dump.sql')

run_mysql_command("START SLAVE")
Expand Down

0 comments on commit f85ccc3

Please sign in to comment.