Skip to content

Instantly share code, notes, and snippets.

@jbuck
Created September 12, 2017 17:04
Show Gist options
  • Save jbuck/2bf23cf1c88e8e05096f8be848a27ea4 to your computer and use it in GitHub Desktop.
Save jbuck/2bf23cf1c88e8e05096f8be848a27ea4 to your computer and use it in GitHub Desktop.
gh-ost migration scripts
gh-ost \
--max-load=Threads_running=25 \
--assume-rbr \
--critical-load=Threads_running=1000 \
--chunk-size=1000 \
--max-lag-millis=15000 \
--user="" \
--password="" \
--host="" \
--assume-master-host="" \
--database="" \
--table="devices" \
--verbose \
--alter="ADD COLUMN nameUtf8 VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin" \
--cut-over=default \
--exact-rowcount \
--concurrent-rowcount \
--default-retries=120 \
--panic-flag-file=/tmp/ghost.panic.flag \
--postpone-cut-over-flag-file=/tmp/ghost.postpone.flag \
--execute # this flag actually starts the migration
gh-ost \
--max-load=Threads_running=25 \
--assume-rbr \ # required for RDS
--critical-load=Threads_running=1000 \
--chunk-size=1000 \
--max-lag-millis=15000 \ # fxa doesn't use replicas, so we can go 15s out of sync
--user="" \ # user that has the right privileges to the database & replication
--password="" \
--host="" \ # read replica with binlog_format=ROW set
--assume-master-host="" \ # master
--database="fxa" \
--table="devices" \
--verbose \
--alter="ADD COLUMN nameUtf8 VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin" \
--cut-over=default \
--exact-rowcount \
--concurrent-rowcount \
--default-retries=120 \
--panic-flag-file=/tmp/ghost.panic.flag \
--postpone-cut-over-flag-file=/tmp/ghost.postpone.flag # create this file to postpone the cutover until the file is removed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment