Created
February 6, 2020 15:30
-
-
Save borama/0fef678d59ac8dd9604ed1bddc3fcb1b to your computer and use it in GitHub Desktop.
Helper shell script for running the gh-ost tool
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
#!/bin/bash | |
function usage { | |
echo "Use ./run_ghost.sh table_name 'alter_command' [other_ghost_args]" | |
exit 1 | |
} | |
database="MY_DATABASE_NAME" | |
table=$1 | |
shift | |
if [ "$table" == "" ]; then | |
usage | |
fi | |
alter=$1 | |
shift | |
if [ "$alter" == "" ]; then | |
usage | |
fi | |
cut_over_file=/root/bin/gh-ost-cut-over.txt | |
touch $cut_over_file | |
./gh-ost --host=localhost --conf=/root/.my-ghost.cnf --database=$database \ | |
--table=$table \ | |
--alter="$alter" \ | |
--chunk-size=2000 --max-load=Threads_connected=50 \ | |
--allow-on-master --ssl --ssl-allow-insecure --exact-rowcount \ | |
--initially-drop-ghost-table --initially-drop-socket-file \ | |
--postpone-cut-over-flag-file=$cut_over_file \ | |
--verbose $* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This likely won't make much sense without reading the accompanying arcticle at dev.to.