GitHub开源MySQL Online DDL工具gh-ost参数解析

源文将持续更新,请点击此处阅读原文

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 is wing._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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值