3.7 KiB
3.7 KiB
Interactive commands
gh-ost
is designed to be operations friendly. To that effect, it allows the user to control its behavior even while it is running.
Interactive interfaces
gh-ost
listens on:
- Unix socket file: either provided via
--serve-socket-file
or determined bygh-ost
, this interface is always up. When self-determined,gh-ost
will advertise the identify of socket file upon start up and throughout the migration. - TCP: if
--serve-tcp-port
is provided
Both interfaces may serve at the same time. Both respond to simple text command, which makes it easy to interact via shell.
Known commands
help
: shows a brief list of available commandsstatus
: returns a status summary of migration progress and configuration replication lag on to determine throttlingchunk-size=<newsize>
: modify thechunk-size
; applies on next running copy-iterationmax-lag-millis=<max-lag>
: modify the maximum replication lag threshold (milliseconds, minimum value is1000
, i.e. 1 second)max-load=<max-load-thresholds>
: modify themax-load
config; applies on next running copy-iteration Themax-load
format 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=1000
to the socket.critical-load=<load>
: change critical load setting (exceeding given thresholds causes panic and abort)nice-ratio=<ratio>
: change nice ratio: 0 for aggressive, positive integern
: for any unit of time spent copying rows, spendn
units of time sleeping.throttle-query
: change throttle querythrottle-control-replicas
: change list of throttle-control replicas, these are replicasgh-ost
will cehckthrottle
: force migration suspendno-throttle
: cancel forced suspension (though other throttling reasons may still apply)unpostpone
: at a time wheregh-ost
is postponing the cut-over phase, instructgh-ost
to stop postponing and proceed immediately to cut-over.panic
: immediately panic and abort operation
Examples
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; 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; Elapsed: 40s(copy), 41s(total); streamer: mysql-bin.000550:49942; ETA: throttled, flag-file
$ 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; 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 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; Elapsed: 59s(copy), 59s(total); streamer: mysql-bin.000551:68067; ETA: throttled, commanded by user