Skip to content

Instantly share code, notes, and snippets.

@mehiel
Forked from borama/run_ghost.sh
Created May 30, 2020 15:46
Show Gist options
  • Save mehiel/49ee956051082d454da21452426a262a to your computer and use it in GitHub Desktop.
Save mehiel/49ee956051082d454da21452426a262a to your computer and use it in GitHub Desktop.
Helper shell script for running the gh-ost tool
#!/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