Skip to content

Commit a5f0a64

Browse files
author
Shlomi Noach
authored
Merge pull request #59 from github/more-docs-4
More docs
2 parents 0749e02 + b042fc1 commit a5f0a64

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Please meanwhile refer to the [docs](doc) for more information. No, really, go t
1818
- [Cut over phase](doc/cut-over.md)
1919
- [Testing on replica](doc/testing-on-replica.md)
2020
- [Throttle](doc/throttle.md)
21+
- [Operational perks](perks.md)
2122
- [Migrating with Statement Based Replication](doc/migrating-with-sbr.md)
2223
- [Understanding output](doc/understanding-output.md)
2324
- [Interactive commands](doc/interactive-commands.md)

doc/perks.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Perks
2+
3+
Listed below are some operation perks that make the DBA happy.
4+
5+
### Dynamic reconfiguration
6+
7+
You started with a `chunk-size=5000` but you find out it's too much. You want to reduce it. There is no need to kill and restart the migration with a new configuration. You may change the `chunk-size` dynamically.
8+
9+
`gh-ost` listens on a unix socket file, and optionally via `TCP` as well. You may, for example:
10+
11+
```shell
12+
$ echo "chunk-size=250" | nc -U /tmp/gh-ost.test.sample_data_0.sock
13+
```
14+
15+
Read more about [interactive commands](interactive-commands.md)
16+
17+
### What's the status?
18+
19+
You do not have to have access to the `screen` where the migration is issued. You have two ways to get current status:
20+
21+
0. Use [interactive commands](interactive-commands.md). Via unix socket file or via `TCP` you can get current status:
22+
23+
```shell
24+
$ echo status | nc -U /tmp/gh-ost.test.sample_data_0.sock
25+
# Migrating `test`.`sample_data_0`; Ghost table is `test`.`_sample_data_0_gst`
26+
# Migration started at Tue Jun 07 11:45:16 +0200 2016
27+
# chunk-size: 200; max lag: 1500ms; max-load: map[Threads_connected:20]
28+
# Throttle additional flag file: /tmp/gh-ost.throttle
29+
# Serving on unix socket: /tmp/gh-ost.test.sample_data_0.sock
30+
# Serving on TCP port: 10001
31+
Copy: 0/2915 0.0%; Applied: 0; Backlog: 0/100; Elapsed: 40s(copy), 41s(total); streamer: mysql-bin.000550:49942; ETA: throttled, flag-file
32+
```
33+
34+
0. `gh-ost` creates and uses a changelog table for internal bookkeeping. This table has the `_osc` suffix (the tool creates and announces this table upon startup) If you like, you can SQL your status:
35+
36+
```
37+
> select * from _sample_data_0_osc order by id desc limit 1 \G
38+
*************************** 1. row ***************************
39+
id: 325
40+
last_update: 2016-06-08 15:52:13
41+
hint: copy iteration 0 at 1465393933
42+
value: Copy: 0/2915 0.0%; Applied: 0; Backlog: 0/100; Elapsed: 1m35s(copy), 1m35s(total); streamer: mysql-bin.000560:60904; ETA: throttled, flag-file
43+
```
44+
45+
### Postpone the cut-over phase
46+
47+
You begin a migration, and the ETA is for it to complete at 04:00am. Not a good time for you, because you happen to want to have eyes on things as the migration completes (ideally, you shouldn't need to, but life is hard).
48+
49+
Today, DBAs are coordinating the migration start time such that it completes in a convenient hour. `gh-ost` offers an alternative: postpone the final cut-over phase till you're ready.
50+
51+
Execute `gh-ost` with `--postpone-cut-over-flag-file=/path/to/flag.file`. As long as this file exists, `gh-ost` will not take the final cut-over step. It will complete the row copy, and continue to synchronize the tables by continuously applying changes made on the original table onto the ghost table. It can do so on and on and on. When you're finally ready, remove the file and cut-over will take place.

0 commit comments

Comments
 (0)