Skip to content

Commit f85ccc3

Browse files
committed
Add nice output for slow MySQL replication
Importing the dump might take a while so this lets people know what's going on.
1 parent f7d7dfd commit f85ccc3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mysql.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ def replicate_slave_from_master(master):
8686
run_mysql_command("STOP SLAVE")
8787
run_mysql_command("SET GLOBAL slow_query_log=OFF")
8888

89+
with hide('running', 'stdout'):
90+
database_file_size = run("stat --format='%s' dump.sql")
91+
92+
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)))
8993
run('sudo -i mysql -uroot < dump.sql')
9094

9195
run_mysql_command("START SLAVE")

0 commit comments

Comments
 (0)