gh-ost版本:1.0.28
-allow-master-master
允许gh-ost运行在双主复制架构中,一般与
-assume-master-host
参数一起使用。
-allow-nullable-unique-key
允许gh-ost在数据迁移(migrate)依赖的唯一键可以为NULL,默认为不允许为NULL的唯一键。如果数据迁移(migrate)依赖的唯一键允许NULL值,则可能造成数据不正确,请谨慎使用。
-allow-on-master
允许gh-ost直接运行在主库上。默认gh-ost连接的从库。
-alter string
ALTER语句的body部分,如”ALTER TABLE wing ADD COLUMN id int not null default 0”,使用gh-ost的
-alter
参数时,写成-alter ADD COLUMN id int not null default 0
即可。
-approve-renamed-columns ALTER
如果你修改一个列的名字(如change column),gh-ost将会识别到并且需要提供重命名列名的原因,默认情况下gh-ost是不继续执行的,除非提供
-approve-renamed-columns ALTER
。e.g:
没有添加
-approve-renamed-columns ALTER
参数,并且修改列名:
gh-ost -user="wing" -host="127.0.0.1" -port=3306 -database="wing" -table="t" -password="wing" -alter="change column col1 c1 int not null default 0" -assume-rbr -execute
2016-12-07 16:39:55 FATAL gh-ost believes the ALTER statement renames columns, as follows: map[col1:col11]; as precation, you are asked to confirm gh-ost is correct, and provide with--approve-renamed-columns
, and we’re all happy. Or you can skip renamed columns via--skip-renamed-columns
, in which case column data may be lost没有添加
-approve-renamed-columns ALTER
参数,并且修改列名为相同名称:
gh-ost -user="wing" -host="127.0.0.1" -port=3306 -database="wing" -table="t" -password="wing" -alter="change column c1 c1 int not null default 0" -assume-rbr -execute
Migrating
wing
.t
; Ghost table iswing
._t_gho
Migrating wing-01:3306; inspecting wing-02:3306; executing on wing-02
Migration started at Wed Dec 07 17:03:22 +0800 2016
chunk-size: 1000; max-lag-millis: 1500ms; max-load: ; critical-load: ; nice-ratio: 0.000000
throttle-additional-flag-file: /tmp/gh-ost.throttle
Serving on unix socket: /tmp/gh-ost.wing.t.sock
Copy: 0/3 0.0%; Applied: 0; Backlog: 0/100; Time: 0s(total), 0s(copy); streamer: mysql-bin.000005:62874; State: migrating; ETA: N/A
Copy: 0/3 0.0%; Applied: 0; Backlog: 0/100; Time: 1s(total), 1s(copy); streamer: mysql-bin.000005:64686; State: migrating; ETA: N/A
Copy: 3/3 100.0%; Applied: 0; Backlog: 0/100; Time: 1s(total), 1s(copy); streamer: mysql-bin.000005:64686; State: migrating; ETA: due
Copy: 3/3 100.0%; Applied: 0; Backlog: 1/100; Time: 2s(total), 1s(copy); streamer: mysql-bin.000005:69035; Stat