You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/command-line-flags.md
+43-15Lines changed: 43 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,10 @@
2
2
3
3
A more in-depth discussion of various `gh-ost` command line flags: implementation, implication, use cases.
4
4
5
+
### allow-master-master
6
+
7
+
See [`--assume-master-host`](#assume-master-host).
8
+
5
9
### allow-on-master
6
10
7
11
By default, `gh-ost` would like you to connect to a replica, from where it figures out the master by itself. This wiring is required should your master execute using `binlog_format=STATEMENT`.
@@ -14,20 +18,20 @@ When your migration issues a column rename (`change column old_name new_name ...
14
18
15
19
`gh-ost` will print out what it thinks the _rename_ implied, but will not issue the migration unless you provide with `--approve-renamed-columns`.
16
20
17
-
If you think `gh-ost` is mistaken and that there's actually no _rename_ involved, you may pass `--skip-renamed-columns` instead. This will cause `gh-ost` to disassociate the column values; data will not be copied between those columns.
21
+
If you think `gh-ost` is mistaken and that there's actually no _rename_ involved, you may pass [`--skip-renamed-columns`](#skip-renamed-columns) instead. This will cause `gh-ost` to disassociate the column values; data will not be copied between those columns.
18
22
19
23
### assume-master-host
20
24
21
25
`gh-ost` infers the identity of the master server by crawling up the replication topology. You may explicitly tell `gh-ost` the identity of the master host via `--assume-master-host=the.master.com`. This is useful in:
22
26
23
-
-master-master topologies (together with `--allow-master-master`), where `gh-ost` can arbitrarily pick one of the co-master and you prefer that it picks a specific one
24
-
-_tungsten replicator_ topologies (together with `--tungsten`), where `gh-ost` is unable to crawl and detect the master
27
+
-_master-master_ topologies (together with [`--allow-master-master`](#allow-master-master)), where `gh-ost` can arbitrarily pick one of the co-masters and you prefer that it picks a specific one
28
+
-_tungsten replicator_ topologies (together with [`--tungsten`](#tungsten)), where `gh-ost` is unable to crawl and detect the master
25
29
26
30
### assume-rbr
27
31
28
32
If you happen to _know_ your servers use RBR (Row Based Replication, i.e. `binlog_format=ROW`), you may specify `--assume-rbr`. This skips a verification step where `gh-ost` would issue a `STOP SLAVE; START SLAVE`.
29
33
Skipping this step means `gh-ost` would not need the `SUPER` privilege in order to operate.
30
-
You may want to use this on Amazon RDS
34
+
You may want to use this on Amazon RDS.
31
35
32
36
### conf
33
37
@@ -41,21 +45,25 @@ password=123456
41
45
42
46
### concurrent-rowcount
43
47
44
-
See `exact-rowcount`
48
+
Defaults to `true`. See [`exact-rowcount`](#exact-rowcount)
45
49
46
-
### critical-load-interval-millis
50
+
### critical-load
51
+
52
+
Comma delimited status-name=threshold, same format as [`--max-load`](#max-load).
47
53
48
54
`--critical-load` defines a threshold that, when met, `gh-ost` panics and bails out. The default behavior is to bail out immediately when meeting this threshold.
49
55
50
56
This may sometimes lead to migrations bailing out on a very short spike, that, while in itself is impacting production and is worth investigating, isn't reason enough to kill a 10 hour migration.
51
57
58
+
### critical-load-interval-millis
59
+
52
60
When `--critical-load-interval-millis` is specified (e.g. `--critical-load-interval-millis=2500`), `gh-ost` gives a second chance: when it meets `critical-load` threshold, it doesn't bail out. Instead, it starts a timer (in this example: `2.5` seconds) and re-checks `critical-load` when the timer expires. If `critical-load` is met again, `gh-ost` panics and bails out. If not, execution continues.
53
61
54
62
This is somewhat similar to a Nagios `n`-times test, where `n` in our case is always `2`.
55
63
56
64
### cut-over
57
65
58
-
Optional. Default is `safe`. See more discussion in [cut-over](cut-over.md)
66
+
Optional. Default is `safe`. See more discussion in [`cut-over`](cut-over.md)
59
67
60
68
### discard-foreign-keys
61
69
@@ -84,8 +92,8 @@ A `gh-ost` execution need to copy whatever rows you have in your existing table
84
92
`gh-ost` also supports the `--exact-rowcount` flag. When this flag is given, two things happen:
85
93
- An initial, authoritative `select count(*) from your_table`.
86
94
This query may take a long time to complete, but is performed before we begin the massive operations.
87
-
When `--concurrent-rowcount` is also specified, this runs in parallel to row copy.
88
-
Note: `--concurrent-rowcount` now defaults to `true`.
95
+
When [`--concurrent-rowcount`](#concurrent-rowcount) is also specified, this runs in parallel to row copy.
96
+
Note: [`--concurrent-rowcount`](#concurrent-rowcount) now defaults to `true`.
89
97
- A continuous update to the estimate as we make progress applying events.
90
98
We heuristically update the number of rows based on the queries we process from the binlogs.
91
99
@@ -95,6 +103,10 @@ While the ongoing estimated number of rows is still heuristic, it's almost exact
95
103
96
104
Without this parameter, migration is a _noop_: testing table creation and validity of migration, but not touching data.
97
105
106
+
### heartbeat-interval-millis
107
+
108
+
Default 100. See [`subsecond-lag`](subsecond-lag.md) for details.
109
+
98
110
### initially-drop-ghost-table
99
111
100
112
`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.
@@ -103,18 +115,22 @@ We think `gh-ost` should not take chances or make assumptions about the user's t
103
115
104
116
### initially-drop-old-table
105
117
106
-
See #initially-drop-ghost-table
118
+
See [`initially-drop-ghost-table`](#initially-drop-ghost-table)
107
119
108
120
### max-lag-millis
109
121
110
122
On a replication topology, this is perhaps the most important migration throttling factor: the maximum lag allowed for migration to work. If lag exceeds this value, migration throttles.
111
123
112
-
When using [Connect to replica, migrate on master](cheatsheet.md), this lag is primarily tested on the very replica `gh-ost` operates on. Lag is measured by checking the heartbeat events injected by `gh-ost` itself on the utility changelog table. That is, to measure this replica's lag, `gh-ost` doesn't need to issue `show slave status` nor have any external heartbeat mechanism.
124
+
When using [Connect to replica, migrate on master](cheatsheet.md#a-connect-to-replica-migrate-on-master), this lag is primarily tested on the very replica `gh-ost` operates on. Lag is measured by checking the heartbeat events injected by `gh-ost` itself on the utility changelog table. That is, to measure this replica's lag, `gh-ost` doesn't need to issue `show slave status` nor have any external heartbeat mechanism.
113
125
114
-
When `--throttle-control-replicas` is provided, throttling also considers lag on specified hosts. Lag measurements on listed hosts is done by querying `gh-ost`'s _changelog_ table, where `gh-ost` injects a heartbeat.
126
+
When [`--throttle-control-replicas`](#throttle-control-replicas) is provided, throttling also considers lag on specified hosts. Lag measurements on listed hosts is done by querying `gh-ost`'s _changelog_ table, where `gh-ost` injects a heartbeat.
115
127
116
128
See also: [Sub-second replication lag throttling](subsecond-lag.md)
117
129
130
+
### max-load
131
+
132
+
List of metrics and threshold values; topping the threshold of any will cause throttler to kick in. See also: [`throttling`](throttle.md#status-thresholds)
133
+
118
134
### migrate-on-replica
119
135
120
136
Typically `gh-ost` is used to migrate tables on a master. If you wish to only perform the migration in full on a replica, connect `gh-ost` to said replica and pass `--migrate-on-replica`. `gh-ost` will briefly connect to the master but other issue no changes on the master. Migration will be fully executed on the replica, while making sure to maintain a small replication lag.
@@ -125,21 +141,29 @@ Indicate a file name, such that the final [cut-over](cut-over.md) step does not
125
141
When this flag is set, `gh-ost` expects the file to exist on startup, or else tries to create it. `gh-ost` exits with error if the file does not exist and `gh-ost` is unable to create it.
126
142
With this flag set, the migration will cut-over upon deletion of the file or upon `cut-over`[interactive command](interactive-commands.md).
127
143
144
+
### replica-server-id
145
+
146
+
Defaults to 99999. If you run multiple migrations then you must provide a different, unique `--replica-server-id` for each `gh-ost` process.
147
+
Optionally involve the process ID, for example: `--replica-server-id=$((1000000000+$$))`.
148
+
149
+
It's on you to choose a number that does not collide with another `gh-ost` or another running replica.
150
+
See also: [`concurrent-migrations`](cheatsheet.md#concurrent-migrations) on the cheatsheet.
151
+
128
152
### skip-foreign-key-checks
129
153
130
154
By default `gh-ost` verifies no foreign keys exist on the migrated table. On servers with large number of tables this check can take a long time. If you're absolutely certain no foreign keys exist (table does not referenece other table nor is referenced by other tables) and wish to save the check time, provide with `--skip-foreign-key-checks`.
131
155
132
156
### skip-renamed-columns
133
157
134
-
See `approve-renamed-columns`
158
+
See [`approve-renamed-columns`](#approve-renamed-columns)
135
159
136
160
### test-on-replica
137
161
138
-
Issue the migration on a replica; do not modify data on master. Useful for validating, testing and benchmarking. See [testing-on-replica](testing-on-replica.md)
162
+
Issue the migration on a replica; do not modify data on master. Useful for validating, testing and benchmarking. See [`testing-on-replica`](testing-on-replica.md)
139
163
140
164
### throttle-control-replicas
141
165
142
-
Provide a command delimited list of replicas; `gh-ost` will throttle when any of the given replicas lag beyond `--max-lag-millis`. The list can be queried and updated dynamically via [interactive commands](interactive-commands.md)
166
+
Provide a command delimited list of replicas; `gh-ost` will throttle when any of the given replicas lag beyond [`--max-lag-millis`](#max-lag-millis). The list can be queried and updated dynamically via [interactive commands](interactive-commands.md)
143
167
144
168
### throttle-http
145
169
@@ -148,3 +172,7 @@ Provide a HTTP endpoint; `gh-ost` will issue `HEAD` requests on given URL and th
148
172
### timestamp-old-table
149
173
150
174
Makes the _old_ table include a timestamp value. The _old_ table is what the original table is renamed to at the end of a successful migration. For example, if the table is `gh_ost_test`, then the _old_ table would normally be `_gh_ost_test_del`. With `--timestamp-old-table` it would be, for example, `_gh_ost_test_20170221103147_del`.
175
+
176
+
### tungsten
177
+
178
+
See [`tungsten`](cheatsheet.md#tungsten) on the cheatsheet.
0 commit comments