Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
MySQL Failover with Consul vol.2
Search
Michael H. Oshita
December 12, 2014
Technology
3
7.7k
MySQL Failover with Consul vol.2
MySQL Casual Talks vol 7. #mysqlcasual
Michael H. Oshita
December 12, 2014
Tweet
Share
More Decks by Michael H. Oshita
See All by Michael H. Oshita
Vibe Coding Tools
ijin
2
360
My small contributions - Fujiwara Tech Conference 2025
ijin
0
3.8k
re:Invent 2024体験談〜Interactivity/Community編〜
ijin
0
17
Fastest AWS re:Invent 2024 re:Cap in the galaxy
ijin
0
21
AWS Management Services
ijin
0
24
Fastest AWS re:Invent 2019 story in the galaxy
ijin
0
160
My DevOps toolsets
ijin
1
1.6k
Serverless Communities (AWS Users Group Netherlands)
ijin
0
61
Serverless Communities (Serverless Days Hamburg 2019)
ijin
0
6.6k
Other Decks in Technology
See All in Technology
Абьюзим random_bytes(). Фёдор Кулаков, разработчик Lamoda Tech
lamodatech
0
290
【TiDB GAME DAY 2025】Shadowverse: Worlds Beyond にみる TiDB 活用術
cygames
0
900
Windows 11 で AWS Documentation MCP Server 接続実践/practical-aws-documentation-mcp-server-connection-on-windows-11
emiki
0
730
PHP開発者のためのSOLID原則再入門 #phpcon / PHP Conference Japan 2025
shogogg
1
370
CSS、JSをHTMLテンプレートにまとめるフロントエンド戦略
d120145
0
230
BrainPadプログラミングコンテスト記念LT会2025_社内イベント&問題解説
brainpadpr
0
160
BigQuery Remote FunctionでLooker Studioをインタラクティブ化
cuebic9bic
2
230
OAuth/OpenID Connectで実現するMCPのセキュアなアクセス管理
kuralab
5
880
20250623 Findy Lunch LT Brown
3150
0
790
AWS Summit Japan 2025 Community Stage - App workflow automation by AWS Step Functions
matsuihidetoshi
1
140
Observability infrastructure behind the trillion-messages scale Kafka platform
lycorptech_jp
PRO
0
130
知識を整理して未来を作る 〜SKDとAI協業への助走〜
yosh1995
0
150
Featured
See All Featured
Speed Design
sergeychernyshev
31
1k
How STYLIGHT went responsive
nonsquared
100
5.6k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
How GitHub (no longer) Works
holman
314
140k
Done Done
chrislema
184
16k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Typedesign – Prime Four
hannesfritz
42
2.7k
The Art of Programming - Codeland 2020
erikaheidi
54
13k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
920
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.4k
Transcript
MYSQL FAILOVER WITH CONSUL VOL. 2 12/12/2014 @ijin MySQL Casual
Talks vol.7
ABOUT ME (@IJIN) • Michael H. Oshita • Japanese American
• 10+ Years in Japan • Software/Infra/Cloud Engineer • http://ijin.github.io
ABOUT ME (@IJIN) τϥϒϧˑ͠Ύʔͨʔͣ
https://walti.io WALTI
BLOG https://ijin.github.io
MYSQL FAILOVER • MySQL • MHA (MySQL Master HA) •
Consul INGREDIENTES:
None
CONSUL
CONSUL HTTP APIͱDNSͰૢ࡞͕Ͱ͖ΔKVଂͳࢄܕΫϥελ
CONSUL AGENT HTTP API /v1/kv/<key> key/value endpoint: RESTful: GET, PUT,
DELETE
CONSUL AGENT HTTP API key/value: base64 raw
CONSUL AGENT DNS Interface <node>.node.<datacenter>.<domain> Node Lookup:
CONSUL AGENT DNS Interface
CONSISTENCY
consensus protocol using raft server server (leader) server CONSISTENCY server
server
consensus protocol using raft server server (leader) server write CONSISTENCY
server server
consensus protocol using raft server server (leader) server write CONSISTENCY
server server write
consensus protocol using raft server server (leader) server write CONSISTENCY
server server write write
consensus protocol using raft server server (leader) server write CONSISTENCY
server server write write quorum[(n/2)+1] reached, commited!
CONSISTENCY writes: ! "?state" or "?consistent" parameter ɾdefault ɾstrongly consistent
ɾstale ! consensus protocol using raft reads: ! Always Strongly Consistent
MHA Master Slave Slave Manager MasterͰোൃੜ
Master Master Slave Manager ֤slaveʹ࠷৽binlogΛద༻͠ɺMasterঢ֨ binlog binlog binlog MHA
MHA master_ip_failover
Slave masterdb.node.consul Slave MHA
Master Slave masterdb.node.consul MHA
"Starting master failover."! "* Phase 1: Configuration Check Phase..\n"! "*
Phase 2: Dead Master Shutdown Phase..\n"! ==> ͜͜ͰچMasterใআ (master_ip_failover)! "* Phase 3: Master Recovery Phase..\n"! "* Phase 3.1: Getting Latest Slaves Phase..\n"! "* Phase 3.2: Saving Dead Master's Binlog Phase..\n"! "* Phase 3.3: Determining New Master Phase..\n"! ==> ͜͜Ͱ৽Masterใొ (master_ip_failover)! "* Phase 4: Slaves Recovery Phase..\n" FAILOVERγʔέϯε MHA
MHA & CONSUL master_ip_failover چmaster IPΛແޮԽ ৽master IPΛొ
IN ACTION https://www.youtube.com/watch?v=rA4hyJ-pccU
ALTERNATIVES ɾconsul event & consul watch ! ɾconsul-template
events propagated over gossip protocol event CONSUL EVENT watch watch
CONSUL EVENT
CONSUL-TEMPLATE haproxy.cfg
CONSUL-TEMPLATE
IN CLOSING • Use consul DNS catalog for MHA failover
• Consul-Template over consul event