gh-ost is designed to be operations friendly. To that effect, it allows the user to control its behavior even while it is running.
gh-ost listens on:
- Unix socket file: either provided via
--serve-socket-fileor determined bygh-ost, this interface is always up. When self-determined,gh-ostwill advertise the identify of socket file upon start up and throughout the migration. - TCP: if
--serve-tcp-portis provided
Both interfaces may serve at the same time. Both respond to simple text command, which makes it easy to interact via shell.
help: shows a brief list of available commandsstatus: returns a detailed status summary of migration progress and configurationsup: returns a brief status summary of migration progresscpu-profile: returns a base64-encodedruntime/pprofCPU profile using a duration, default:30s. Comma-separated optionsgzipand/orblock(blocked profile) may follow the profile durationcoordinates: returns recent (though not exactly up to date) binary log coordinates of the inspected serverapplier: returns the hostname of the applierinspector: returns the hostname of the inspectorchunk-size=<newsize>: modify thechunk-size; applies on next running copy-iterationdml-batch-size=<newsize>: modify thedml-batch-size; applies on next applying of binary log eventsmax-lag-millis=<max-lag>: modify the maximum replication lag threshold (milliseconds, minimum value is100, i.e.0.1second)max-load=<max-load-thresholds>: modify themax-loadconfig; applies on next running copy-iteration- The
max-loadformat must be:some_status=<numeric-threshold>[,some_status=<numeric-threshold>...]' - For example:
Threads_running=50,threads_connected=1000, and you would then write/echomax-load=Threads_running=50,threads_connected=1000to the socket.
- The
critical-load=<critical-load-thresholds>: modify thecritical-loadconfig (exceeding these thresholds aborts the operation)- The
critical-loadformat must be:some_status=<numeric-threshold>[,some_status=<numeric-threshold>...]' - For example:
Threads_running=1000,threads_connected=5000, and you would then write/echocritical-load=Threads_running=1000,threads_connected=5000to the socket.
- The
nice-ratio=<ratio>: change nice ratio: 0 for aggressive (not nice, not sleeping), positive integern:- For any
1msspent copying rows, spendn*1msunits of time sleeping. - Examples: assume a single rows chunk copy takes
100msto complete.nice-ratio=0.5will causegh-ostto sleep for50msimmediately following.nice-ratio=1will causegh-ostto sleep for100ms, effectively doubling runtime- value of
2will effectively triple the runtime; etc.
- For any
throttle-http: change throttle HTTP endpointthrottle-query: change throttle querythrottle-control-replicas='replica1,replica2': change list of throttle-control replicas, these are replicasgh-ostwill check. This takes a comma separated list of replica's to check and replaces the previous list.throttle: force migration suspendno-throttle: cancel forced suspension (though other throttling reasons may still apply)postpone-cut-over-flag-file=<path>: Postpone the cut-over phase, writing a cut over flag file to the given pathunpostpone: at a time wheregh-ostis postponing the cut-over phase, instructgh-ostto stop postponing and proceed immediately to cut-over.panic: immediately panic and abort operation
For commands that accept an argument as value, pass ? (question mark) to get current value rather than set a new one.
While migration is running:
$ echo status | nc -U /tmp/gh-ost.test.sample_data_0.sock
# Migrating `test`.`sample_data_0`; Ghost table is `test`.`_sample_data_0_gst`
# Migration started at Tue Jun 07 11:45:16 +0200 2016
# chunk-size: 200; max lag: 1500ms; dml-batch-size: 10; max-load: map[Threads_connected:20]
# Throttle additional flag file: /tmp/gh-ost.throttle
# Serving on unix socket: /tmp/gh-ost.test.sample_data_0.sock
# Serving on TCP port: 10001
Copy: 0/2915 0.0%; Applied: 0; Backlog: 0/100; Time: 41s(total), 40s(copy); streamer: mysql-bin.000550:49942; Lag: 0.01s, HeartbeatLag: 0.01s, State: throttled, flag-file; ETA: N/A$ echo "chunk-size=250" | nc -U /tmp/gh-ost.test.sample_data_0.sock
# Migrating `test`.`sample_data_0`; Ghost table is `test`.`_sample_data_0_gst`
# Migration started at Tue Jun 07 11:56:03 +0200 2016
# chunk-size: 250; max lag: 1500ms; dml-batch-size: 10; max-load: map[Threads_connected:20]
# Throttle additional flag file: /tmp/gh-ost.throttle
# Serving on unix socket: /tmp/gh-ost.test.sample_data_0.sock
# Serving on TCP port: 10001$ echo "chunk-size=?" | nc -U /tmp/gh-ost.test.sample_data_0.sock
250$ echo throttle | nc -U /tmp/gh-ost.test.sample_data_0.sock
$ echo status | nc -U /tmp/gh-ost.test.sample_data_0.sock
# Migrating `test`.`sample_data_0`; Ghost table is `test`.`_sample_data_0_gst`
# Migration started at Tue Jun 07 11:56:03 +0200 2016
# chunk-size: 250; max lag: 1500ms; max-load: map[Threads_connected:20]
# Throttle additional flag file: /tmp/gh-ost.throttle
# Serving on unix socket: /tmp/gh-ost.test.sample_data_0.sock
# Serving on TCP port: 10001
Copy: 0/2915 0.0%; Applied: 0; Backlog: 0/100; Time: 59s(total), 59s(copy); streamer: mysql-bin.000551:68067; Lag: 0.01s, HeartbeatLag: 0.01s, State: throttled, commanded by user; ETA: N/A