Download - 僕らのMySQL5.6移行記(仮)
![Page 1: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/1.jpg)
僕達のMySQL5.6移行記
![Page 2: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/2.jpg)
星野 豊 (@con_mame)
クックパッド株式会社 インフラストラクチャー部
AWS / MySQL / Redshift / DataStore etc...
http://d.conma.me/
http://facebook.com/conmame
![Page 3: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/3.jpg)
5.6
![Page 4: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/4.jpg)
使ってますか?
![Page 5: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/5.jpg)
5.6.10 or 5.6.13
or
5.6.14
![Page 6: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/6.jpg)
MySQL on EC2
and
RDS
![Page 7: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/7.jpg)
![Page 8: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/8.jpg)
NEW
NEW
update
update
![Page 9: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/9.jpg)
Management tools
Development
Analysis (exclude secure
table / with mysql-
audit)
![Page 10: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/10.jpg)
Move to 5.6 on AWS
![Page 11: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/11.jpg)
5.6.6~ (2012/8/7)
![Page 12: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/12.jpg)
cookpad 主要DBを5.6に
update
Replicationをしつつ本番で
流れるクエリを流す
5.6 新機能のConfiguration
を試していく
![Page 13: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/13.jpg)
cookpad 主要DBを5.6に
update
Replicationをしつつ本番で
流れるクエリを流す
5.6 新機能のConfiguration
を試していく
意外と素直に進んだ!!!
![Page 14: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/14.jpg)
cookpad 主要DBを5.6に
update
Replicationをしつつ本番で
流れるクエリを流す
5.6 新機能のConfiguration
を試していく
意外と素直に進んだ!!!
最初だけ意外と素直に進んだ!!!
![Page 15: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/15.jpg)
Upgrade
![Page 16: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/16.jpg)
5.6 DB群を用意してswitch
メンテナンスでmysql_upgrade
![Page 17: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/17.jpg)
replication
OLDMaster
OLDSlave
OLDSlave
5.6Master
5.6Slave
replication
5.6Slave
![Page 18: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/18.jpg)
replication
OLDMaster
OLDSlave
OLDSlave
5.6Master
5.6Slave
replication
5.6Slave
EBS Snapshotを
作成して5.6群を
作成
![Page 19: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/19.jpg)
replication
OLDMaster
OLDSlave
OLDSlave
5.6Master
5.6Slave
replication
5.6Slave
![Page 20: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/20.jpg)
検証
![Page 21: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/21.jpg)
正常にmysql_upgradeが出来るか
既存スキーマ・クエリでwarningとか出ないか
パフォーマンス
レプリケーションはうまいこと行くか
新機能・パラメータどうするか
アプリケーションサーバなどのライブラリ
運用
BUG
![Page 22: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/22.jpg)
正常にmysql_upgradeが出来るか
既存スキーマ・クエリでwarningとか出ないか
パフォーマンス
レプリケーションはうまいこと行くか
新機能・パラメータどうするか
アプリケーションサーバなどのライブラリ
運用
BUG
![Page 23: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/23.jpg)
アプリケーションサーバなどのライブラリ・
動作
libmysql / mysql2 gem / log
パフォーマンス
slow query / レスポンス速度 / CPU /
memory
既存スキーマ・クエリでwarningとか出ないか
新パラメータとかでDEPRECATEDなものがな
いか
![Page 24: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/24.jpg)
Kage
![Page 25: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/25.jpg)
https://github.com/cookpad/kagehttps://rubygems.org/gems/kage
![Page 26: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/26.jpg)
OLDDB M
proxy
kage
app newapp
OLDDB S
5.6DB M
5.6DB S
![Page 27: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/27.jpg)
OLDDB M
proxy
kage
app newapp
OLDDB S
5.6DB M
5.6DB S
ライブラリ
アプリケーションの動作
![Page 28: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/28.jpg)
OLDDB M
proxy
kage
app newapp
OLDDB S
5.6DB M
5.6DB S
ライブラリ
アプリケーションの動作
warning
チューニング・動作
![Page 29: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/29.jpg)
実際のリクエストで発行されるクエリでテストが行える
漏れが少なくread / writeを実際に動作をさせながら
確認出来る
DB自体の負荷試験は別途行う
テストが行い易くアプリケーション・DB各レイヤーで問
題を見つけやすい・直しながらテスト出来る
![Page 30: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/30.jpg)
他にも
![Page 31: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/31.jpg)
開発・検証用のDBとしてバージョン・設定を変えて動作
させる
開発中のクエリは実際に使用される事が予測される
今後のバージョンアップで問題が出ないか確認しやす
い
バージョンを上げた場合にindexの使われ方が変わるな
どを見つけやすい
MySQLのパフォーマンス向上により調査クエリが高速化
することも
![Page 32: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/32.jpg)
用意している環境
超検証用 (5.6.14 / 5.7.x) -> 主にcon_mame用
検証用 (5.6.13) -> 開発用DB / 調査用DB
本番 (5.6.x) -> 本番 / CI
役割
超検証用 -> BUG調査や新機能・チューニング検証用
検証用 -> 本番データをレプリケーションして開発中
や調査用のクエリを受け付けさせて様子を見る。問題
があれば超検証用インスタンスで調査
![Page 33: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/33.jpg)
replication
productionMaster
5.6 or 5.5 or older...
超検証用 検証用 本番
5.6.10 5.6.11 5.6.12 5.7.x5.6.13
EBS SnapshotとAMIで問題が起こったバー
ジョンを直ぐに起動して調査
本番サーバのEBSは一定
時間おきにSnapshotが
とられている
![Page 34: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/34.jpg)
正常にmysql_upgradeが出来るか
既存スキーマ・クエリでwarningとか出ないか
パフォーマンス
レプリケーションはうまいこと行くか
新機能・パラメータどうするか
アプリケーションサーバなどのライブラリ
運用
BUG
![Page 35: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/35.jpg)
5.6
![Page 36: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/36.jpg)
GTID
運用負荷が意外と大きい
http://d.conma.me/entry/2013/04/23/203036
デフォルト値の変更や非推薦な物
explicit_defaults_for_timestamp
binlog_checksum とかとか
http://dev.mysql.com/doc/refman/5.6/en/upgrading-
from-previous-series.html
Performance Schemeメモリ食いまくり
![Page 37: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/37.jpg)
ピークタイムでレプリケーションエラー起こったら
この手順は…
5.6
5.5
![Page 38: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/38.jpg)
BUG (体験済の一部orz)
mysql.slave_master_info is not updated http://
bugs.mysql.com/bug.php?id=69135
A regression in 5.6 crash recovery atomicity
http://bugs.mysql.com/bug.php?id=68932
memory leak with innodb memcached plugin for stale
connection http://bugs.mysql.com/bug.php?id=68530
replication was broken while executing flush
tables http://bugs.mysql.com/bug.php?id=69045
Invalid use of GRANT command breaks replication
http://bugs.mysql.com/bug.php?id=68892
![Page 39: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/39.jpg)
Conclusion
![Page 40: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/40.jpg)
5.6はそろそろ気軽に使えるようになった
GTID... / Performance Scheme....
AWS上で検証するなら、Casualに検証できる
EBS Snapshot / AMI
検証はしっかりと
Kage便利
![Page 41: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/41.jpg)
5.6はそろそろ気軽に使えるようになった
GTID... / Performance Scheme....
AWS上で検証するなら、Casualに検証できる
EBS Snapshot / AMI
検証はしっかりと
Kage便利
http://bugs.mysql.com/
見てますよね?
![Page 42: 僕らのMySQL5.6移行記(仮)](https://reader037.vdocuments.pub/reader037/viewer/2022110115/54b75e994a7959f71f8b460b/html5/thumbnails/42.jpg)
Thank you!!