MySQL 零停机表结构变更:gh-ost 与 pt-online-schema-changegh-ost 示例gh-ost \
--host=127.0.0.1 --port=3306 \
--user=root --password=secret \
--database=app --table=items \
--alter="ADD COLUMN category VARCHAR(64) NULL" \
--execute
pt-online-schema-change 示例pt-online-schema-change \
--alter "ADD INDEX idx_name(name)" \
D=app,t=items --execute
验证与注意确认外键与触发器影响在从库或影子表验证后再执行生产观察复制延迟与回放情况总结在线 DDL 工具能在高可用场景下平滑变更,需严格演练与监控。

发表评论 取消回复