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
7.8k
3
Share
MySQL Failover with Consul vol.2
MySQL Casual Talks vol 7. #mysqlcasual
Michael H. Oshita
December 12, 2014
More Decks by Michael H. Oshita
See All by Michael H. Oshita
JAWS-UG Yokohama 100th event
ijin
0
0
AI platform engineering
ijin
0
1
Fastest AWS re:Invent 2025 re:Cap in the galaxy
ijin
0
0
Lambda management with ecspresso and Terraform
ijin
2
270
Vibe Coding Tools
ijin
2
480
My small contributions - Fujiwara Tech Conference 2025
ijin
0
4.7k
re:Invent 2024体験談〜Interactivity/Community編〜
ijin
0
66
Fastest AWS re:Invent 2024 re:Cap in the galaxy
ijin
0
48
AWS Management Services
ijin
0
69
Other Decks in Technology
See All in Technology
BIツール「Omni」の紹介 @Snowflake中部UG
sagara
0
270
ログ基盤・プラグイン・ダッシュボード、全部整えた。でも最後は人だった。
makikub
5
1.7k
3つのボトルネックを解消し、リリースエンジニアリングを再定義した話
nealle
0
380
GitHub Copilotを極める会 - 開発者のための活用術
findy_eventslides
6
4k
新規サービス開発におけるReact Nativeのリアル〜技術選定の裏側と実践的OSS活用〜
grandbig
2
180
Bill One 開発エンジニア 紹介資料
sansan33
PRO
5
18k
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
6
74k
New CBs New Challenges
ysuzuki
1
170
TanStack Start エコシステムの現在地 / TanStack Start Ecosystem 2026
iktakahiro
1
370
幾億の壁を超えて/Beyond Countless Walls(JP)
ikuodanaka
0
110
ルールルルルル私的函館観光ガイド── 函館の街はイクラでも楽しめる!
nomuson
0
160
本番環境でPHPコードに触れずに「使われていないコード」を調べるにはどうしたらよいか?
egmc
2
280
Featured
See All Featured
30 Presentation Tips
portentint
PRO
1
270
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.2k
The Pragmatic Product Professional
lauravandoore
37
7.2k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.4k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
160
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.1k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
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