Mysql zero downtime deployment
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mysql zero downtime deployment相关的知识,希望对你有一定的参考价值。
Why we cannot perform an alter table directly to update schema?
How mysql performs alter table:
Lock the table
Make a copy of the table
Modify the copy (the "new table")
Copy all the rows into the new table
Swap the old and new table
Unlock the table
The key issue here is that lock time will be quite long for large table, whick blocks online transaction.
Percona‘s solution:
pt-online-schema-change tool:
How pt-online-schema-change performs alter table?
Make a copy of the table
Modify the copy (the "new table")
Copy all the rows into the new table (do in small chunks, insert .. select)
Add triggers to keep track of changes
Swap the old and new table
Pros:
Remove the Lock/unlock steps, no longer blocking
Replication-Awareness
Load awareness -> chunk size is auto adjusted
Cons:
About 4th slower than alter table directly
Limitation:
Cannot handle foreign key perfectly
xtrabackup
本文出自 “shadowisper” 博客,谢绝转载!
以上是关于Mysql zero downtime deployment的主要内容,如果未能解决你的问题,请参考以下文章
[原创]zero downtime using goldengate实现oracle 12C升级系列 第四篇:集群安装
[原创]zero downtime using goldengate实现oracle 12C升级系列 第三篇:asmlib配置