Skip to content

Commit 8e32604

Browse files
author
Shlomi Noach
committed
more documentation
1 parent 3cb8061 commit 8e32604

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ It is still OK to connect `gh-ost` directly on master; you will need to confirm
3030

3131
#### Testing on replica
3232

33+
Newcomer? We think you would enjoy building trust with this tool. You can ask `gh-ost` to simulate a migration on a replica -- this will not affect data on master and will not actually do a complete migration. It will operate on a replica, and end up with two tables: the original (untouched), and the migrated. You will have your chance to compare the two and verify the tool works to your satisfaction.
34+
3335
```
3436
gh-ost --conf=.my.cnf --database=mydb --table=mytable --verbose --alter="engine=innodb" --execute --initially-drop-ghost-table --initially-drop-old-table -max-load=Threads_connected=30 --switch-to-rbr --chunk-size=2500 --cut-over=two-step --exact-rowcount --test-on-replica --verbose
3537
```
@@ -41,10 +43,24 @@ Please read more on [testing on replica](testing-on-replica.md)
4143
gh-ost --conf=.my.cnf --database=mydb --table=mytable --verbose --alter="engine=innodb" --execute --initially-drop-ghost-table --initially-drop-old-table -max-load=Threads_connected=30 --switch-to-rbr --chunk-size=2500 --cut-over=two-step --exact-rowcount --verbose
4244
```
4345

44-
#### Recommended parameters
46+
Note: "executing on master" does not mean you need to _connect_ to the master. `gh-ost` is happy if you connect to a replica; it then figures out the identity of the master and makes the connection itself.
47+
48+
#### Notable parameters
4549

4650
Run `gh-ost --help` to get full list of parameters. We like the following:
4751

52+
- `--conf=/path/to/my.cnf`: file where credentials are specified. Should be in (or contain) the following format:
53+
54+
```
55+
[client]
56+
user=gromit
57+
password=123456
58+
```
59+
60+
- `--user`, `--password`: alternatively, supply these as arguments
61+
62+
- `--host`, `--port`: where to connect to. `gh-ost` prefers to connect to a replica, see above.
63+
4864
- `--exact-rowcount`: actually `select count(*)` from your table prior to migration, and heuristically maintain the updating table size while migrating. This makes for quite accurate assumption on progress. When `gh-ost` says it's `99.8%` done, it really there or very closely there.
4965

5066
- `--execute`: without this parameter, migration is a _noop_: testing table creation and validity of migration, but not touching data.

doc/command-line-flags.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
A more in-depth discussion of various `gh-ost` command line flags: implementation, implication, use cases.
44

5+
##### conf
6+
7+
`--conf=/path/to/my.cnf`: file where credentials are specified. Should be in (or contain) the following format:
8+
9+
```
10+
[client]
11+
user=gromit
12+
password=123456
13+
```
14+
515
##### cut-over
616

717
Required. You are asked to explicitly state which cut-over algorithm you wish to use. Please see more discussion on [cut-over](cut-over.md)
@@ -19,9 +29,19 @@ A `gh-ost` execution need to copy whatever rows you have in your existing table
1929

2030
While the ongoing estimated number of rows is still heuristic, it's almost exact, such that the reported [ETA](understanding-output.md) or percentage progress is typically accurate to the second throughout a multiple-hour operation.
2131

22-
##### noop
32+
##### execute
33+
34+
Without this parameter, migration is a _noop_: testing table creation and validity of migration, but not touching data.
35+
36+
##### initially-drop-ghost-table
37+
38+
`gh-ost` maintains two tables while migrating: the _ghost_ table (which is synced from your original table and finally replaces it) and a changelog table, which is used internally for bookkeeping. By default, it panics and aborts if it sees those tables upon startup. Provide `--initially-drop-ghost-table` and `--initially-drop-old-table` to let `gh-ost` know it's OK to drop them beforehand.
39+
40+
We think `gh-ost` should not take chances or make assumptions about the user's tables. Dropping tables can be a dangerous, locking operation. We let the user explicitly approve such operations.
41+
42+
##### initially-drop-old-table
2343

24-
Do cheks; create ghost table and verify migration would be valid, but do not actually migrate and do not touch data.
44+
See #initially-drop-ghost-table
2545

2646
##### test-on-replica
2747

doc/throttle.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ In addition to the above, you are able to take control and throttle the operatio
5757

5858
- `throttle` command via [interactive interface](interactive-commands.md).
5959

60-
Example: ```
60+
Example:
61+
62+
```
6163
echo throttle | nc -U /tmp/gh-ost.test.sample_data_0.sock
6264
echo no-throttle | nc -U /tmp/gh-ost.test.sample_data_0.sock
6365
```
@@ -73,6 +75,7 @@ The first check to suggest throttling stops the search; the status message will
7375
### Throttle status
7476

7577
The throttle status is printed as part of the periodic [status message](understanding-output.md):
78+
7679
```
7780
Copy: 0/2915 0.0%; Applied: 0; Backlog: 0/100; Elapsed: 41s(copy), 41s(total); streamer: mysql-bin.000551:47983; ETA: throttled, flag-file
7881
Copy: 0/2915 0.0%; Applied: 0; Backlog: 0/100; Elapsed: 42s(copy), 42s(total); streamer: mysql-bin.000551:49370; ETA: throttled, commanded by user

0 commit comments

Comments
 (0)