@llplmlyd
2023-05-11T03:34:19.000000Z
字数 1345
阅读 363
数据库-tools
pt-online-schema-change --alter "$sql" D=$DB,t=$table --critical-load="Threads_running=500" --charset=utf8 --no-check-replication-filters --alter-foreign-keys-method=auto --recursion-method=none --execute
## 原表CONSTRAINT `fk_foo` FOREIGN KEY (`foo_id`) REFERENCES `bar` (`foo_id`)## pt-online-change-schema 语法--alter "drop foreign key _fk_foo"
数据复制过程是在小块数据中执行的,对这些数据进行更改以尝试使它们在特定的时间内执行,
将变更划分成等份的chunk 然后每份chunk执行的时间为chunk-time
在线变更的参数
D=databasename,t=tablename--no-check-replication-filters--alter-foreign-keys-method=s How to modify foreign keys so they referencethe new table#修改外键的方式选择,默认选择auto--[no]check-replication-filters Abort if any replication filter is set onany server (default yes)# 如果设置了复制过滤规则,则停止运行--[no]check-unique-key-change Avoid pt-online-schema-change to run if theadd an unique index (default yes)# 如果在线运行添加的是唯一键,则会直接拒绝退出运行--check-slave-lag=s Pause the data copy until this replica's lagis less than --max-lag
