Skip to content

Commit 6aba76c

Browse files
author
Shlomi Noach
committed
cheatsheet text
1 parent 8ae191c commit 6aba76c

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

doc/cheatsheet.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
11
# Cheatsheet
22

33
![operation modes](images/gh-ost-operation-modes.png)
4+
5+
6+
`gh-ost` operates by connecting to potentially multiple servers, as well as imposing itself as a replica in order to streamline binary log events directly from one of those servers. There are various operation modes, which depend on your setup, configuration, and where you want to run the migration.
7+
8+
##### a. Connect to replica, migrate on master
9+
10+
This is the mode `gh-ost` expects by default. `gh-ost` will investigate the replica, crawl up to find the topology's master, and will hook onto it as well. Migration will:
11+
12+
- Read and write row-data on master
13+
- Read binary logs events on the replica, apply the changes onto the master
14+
- Investigates table format, columns & keys, count rows on the replica
15+
- Read internal changelog events (such as heartbeat) from the replica
16+
- Cut-over (switch tables) on the master
17+
18+
If your master works with SBR, this is the mode to work with. The replica must be configured with binary logs enabled (`log_bin`, `log_slave_updates`) and should have `binlog_format=ROW` (`gh-ost` can apply the latter for you).
19+
20+
However even with RBR we suggest this is the least master-intrusive operation mode.
21+
22+
##### b. Connect to master
23+
24+
If you don't have replicas, or do not wish to use them, you are still able to operate directly on the master. `gh-ost` will do all operations directly on the master. You may still ask it to be considerate of replication lag.
25+
26+
- Your master must produce binary logs in RBR format.
27+
- You must approve this mode via `--allow-on-master`.
28+
29+
##### c. Migrate/test on replica
30+
31+
This will perform a migration on the replica. `gh-ost` will briefly connect to the master but will thereafter perform all operations on the replica without modifying anything on the master.
32+
Throughout the operation, `gh-ost` will throttle such that the replica is up to date.
33+
34+
- `--migrate-on-replica` indicates to `gh-ost` that it must migrate the table directly on the replica. It will perform the cut-over phase even while replication is running.
35+
- `--test-on-replica` indicates the migration is for purpose of testing only. Before cut-over takes place, replication is stopped. Tables are swapped and then swapped back: your original table returns to its original place.
36+
Both tables are left with replication stopped. You may examine the two and compare data.

0 commit comments

Comments
 (0)