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
#### GitHub's online schema migration for MySQL <imgsrc="doc/images/gh-ost-logo-light-160.png"align="right">
4
6
5
7
`gh-ost` is a triggerless online schema migration solution for MySQL. It is testable and provides pausability, dynamic control/reconfiguration, auditing, and many operational perks.
@@ -81,6 +84,8 @@ But then a rare genetic mutation happened, and the `c` transformed into `t`. And
81
84
82
85
We develop `gh-ost` at GitHub and for the community. We may have different priorities than others. From time to time we may suggest a contribution that is not on our immediate roadmap but which may appeal to others.
83
86
87
+
Please see [Coding gh-ost](https://github.com/github/gh-ost/blob/develdocs/doc/coding-ghost.md) for a guide to getting started developing with gh-ost.
88
+
84
89
## Download/binaries/source
85
90
86
91
`gh-ost` is now GA and stable.
@@ -89,7 +94,9 @@ We develop `gh-ost` at GitHub and for the community. We may have different prior
`gh-ost` is a Go project; it is built with Go 1.5 with "experimental vendor". Soon to migrate to Go 1.6. See and use [build file](https://github.com/github/gh-ost/blob/master/build.sh) for compiling it on your own.
97
+
`gh-ost` is a Go project; it is built with Go `1.8` (though `1.7` should work as well). To build on your own, use either:
98
+
-[script/build](https://github.com/github/gh-ost/blob/master/script/build) - this is the same build script used by CI hence the authoritative; artifact is `./bin/gh-ost` binary.
99
+
-[build.sh](https://github.com/github/gh-ost/blob/master/build.sh) for building `tar.gz` artifacts in `/tmp/gh-ost`
93
100
94
101
Generally speaking, `master` branch is stable, but only [releases](https://github.com/github/gh-ost/releases) are to be used in production.
Getting started with gh-ost development is simple!
6
+
7
+
- First obtain the repository with `git clone` or `go get`.
8
+
- From inside of the repository run `script/cibuild`
9
+
- This will bootstrap the environment if needed, format the code, build the code, and then run the unit test.
10
+
11
+
## CI build workflow
12
+
13
+
`script/cibuild` performs the following actions will bootstrap the environment to build `gh-ost` correctly, build, perform syntax checks and run unit tests.
14
+
15
+
If additional steps are needed, please add them into this workflow so that the workflow remains simple.
16
+
17
+
## Notes:
18
+
19
+
Currently, `script/ensure-go-installed` will install `go` for Mac OS X and Linux. We welcome PR's to add other platforms.
Copy file name to clipboardExpand all lines: doc/command-line-flags.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -131,6 +131,14 @@ See `approve-renamed-columns`
131
131
132
132
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)
133
133
134
+
### throttle-control-replicas
135
+
136
+
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)
137
+
138
+
### throttle-http
139
+
140
+
Provide a HTTP endpoint; `gh-ost` will issue `HEAD` requests on given URL and throttle whenever response status code is not `200`. The URL can be queried and updated dynamically via [interactive commands](interactive-commands.md). Empty URL disables the HTTP check.
141
+
134
142
### timestamp-old-table
135
143
136
144
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`.
Copy file name to clipboardExpand all lines: doc/interactive-commands.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,7 @@ Both interfaces may serve at the same time. Both respond to simple text command,
17
17
-`help`: shows a brief list of available commands
18
18
-`status`: returns a detailed status summary of migration progress and configuration
19
19
-`sup`: returns a brief status summary of migration progress
20
+
-`coordinates`: returns recent (though not exactly up to date) binary log coordinates of the inspected server
20
21
-`chunk-size=<newsize>`: modify the `chunk-size`; applies on next running copy-iteration
21
22
-`max-lag-millis=<max-lag>`: modify the maximum replication lag threshold (milliseconds, minimum value is `100`, i.e. `0.1` second)
22
23
-`max-load=<max-load-thresholds>`: modify the `max-load` config; applies on next running copy-iteration
@@ -31,6 +32,7 @@ Both interfaces may serve at the same time. Both respond to simple text command,
31
32
-`nice-ratio=0.5` will cause `gh-ost` to sleep for `50ms` immediately following.
32
33
-`nice-ratio=1` will cause `gh-ost` to sleep for `100ms`, effectively doubling runtime
33
34
- value of `2` will effectively triple the runtime; etc.
35
+
-`throttle-http`: change throttle HTTP endpoint
34
36
-`throttle-query`: change throttle query
35
37
-`throttle-control-replicas='replica1,replica2'`: change list of throttle-control replicas, these are replicas `gh-ost` will check. This takes a comma separated list of replica's to check and replaces the previous list.
`gh-ost` has been updated to work with Amazon RDS however due to GitHub not relying using AWS for databases, this documentation is community driven so if you find a bug please [open an issue][new_issue]!
2
+
3
+
# Amazon RDS
4
+
5
+
## Limitations
6
+
7
+
- No `SUPER` privileges.
8
+
-`gh-ost` runs should be setup use [`--assume-rbr`][assume_rbr_docs] and use `binlog_format=ROW`.
9
+
- Aurora does not allow editing of the `read_only` parameter. While it is defined as `{TrueIfReplica}`, the parameter is non-modifiable field.
10
+
11
+
## Aurora
12
+
13
+
#### Replication
14
+
15
+
In Aurora replication, you have separate reader and writer endpoints however because the cluster shares the underlying storage layer, `gh-ost` will detect it is running on the master. This becomes an issue when you wish to use [migrate/test on replica][migrate_test_on_replica_docs] because you won't be able to use a single cluster in the same way you would with MySQL RDS.
16
+
17
+
To work around this, you can follow along the [AWS replication between clusters documentation][aws_replication_docs] for Aurora with one small caveat. For the "Create a Snapshot of Your Replication Master" step, the binlog position is not available in the AWS console. You will need to issue the SQL query `SHOW SLAVE STATUS` or `aws rds describe-events` API call to get the correct position.
18
+
19
+
#### Percona Toolkit
20
+
21
+
If you use `pt-table-checksum` as a part of your data integrity checks, you might want to check out [this patch][percona_toolkit_patch] which will enable you to run `pt-table-checksum` with the `--no-binlog-format-check` flag and prevent errors like the following:
22
+
23
+
```
24
+
03-24T12:51:06 Failed to /*!50108 SET @@binlog_format := 'STATEMENT'*/: DBD::mysql::db do failed: Access denied; you need (at least one of) the SUPER privilege(s) for this operation [for Statement "/*!50108 SET @@binlog_format := 'STATEMENT'*/"] at pt-table-checksum line 9292.
25
+
26
+
This tool requires binlog_format=STATEMENT, but the current binlog_format is set to ROW and an error occurred while attempting to change it. If running MySQL 5.1.29 or newer, setting binlog_format requires the SUPER privilege. You will need to manually set binlog_format to 'STATEMENT' before running this tool.
27
+
```
28
+
29
+
#### Preflight checklist
30
+
31
+
Before trying to run any `gh-ost` migrations you will want to confirm the following:
32
+
33
+
-[ ] You have a secondary cluster available that will act as a replica. Rule of thumb here has been a 1 instance per cluster to mimic MySQL-style replication as opposed to Aurora style.
34
+
-[ ] The database instance parameters and database cluster parameters are consistent between your master and replicas
35
+
-[ ] Executing `SHOW SLAVE STATUS\G` on your replica cluster displays the correct master host, binlog position, etc.
36
+
-[ ] Database backup retention is greater than 1 day to enable binlogs
37
+
-[ ] You have setup [`hooks`][ghost_hooks] to issue RDS procedures for stopping and starting replication. (see [github/gh-ost#163][ghost_rds_issue_tracking] for examples)
Copy file name to clipboardExpand all lines: doc/requirements-and-limitations.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,8 +40,8 @@ The `SUPER` privilege is required for `STOP SLAVE`, `START SLAVE` operations. Th
40
40
- It is not allowed to migrate a table where another table exists with same name and different upper/lower case.
41
41
- For example, you may not migrate `MyTable` if another table called `MYtable` exists in the same schema.
42
42
43
-
- Amazon RDS and Google Cloud SQL are currently not supported
44
-
- We began working towards removing this limitation. See tracking issue: https://github.com/github/gh-ost/issues/163
43
+
- Amazon RDS works, but has it's own [limitations](rds.md).
44
+
- Google Cloud SQL is currently not supported
45
45
46
46
- Multisource is not supported when migrating via replica. It _should_ work (but never tested) when connecting directly to master (`--allow-on-master`)
0 commit comments