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
Lambda management with ecspresso and Terraform
ijin
2
260
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
68
Fastest AWS re:Invent 2019 story in the galaxy
ijin
0
200
My DevOps toolsets
ijin
1
1.7k
Serverless Communities (AWS Users Group Netherlands)
ijin
0
80
Other Decks in Technology
See All in Technology
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
11k
SSoT(Single Source of Truth)で「壊して再生」する設計
kawauso
2
400
第26回FA設備技術勉強会 - Claude/Claude_codeでデータ分析 -
happysamurai294
0
220
DMBOKを使ってレバレジーズのデータマネジメントを評価した
leveragestech
0
490
「活動」は激変する。「ベース」は変わらない ~ 4つの軸で捉える_AI時代ソフトウェア開発マネジメント
sentokun
0
140
AWS DevOps Agent or Kiro の使いどころを考える_20260402
masakiokuda
0
120
SaaSの操作主体は人間からAIへ - 経理AIエージェントが目指す深い自動化
nishihira
0
130
AI時代のオンプレ-クラウドキャリアチェンジ考
yuu0w0yuu
0
680
Microsoft Fabricで考える非構造データのAI活用
ryomaru0825
0
550
ハーネスエンジニアリング×AI適応開発
aictokamiya
1
910
The essence of decision-making lies in primary data
kaminashi
0
190
ThetaOS - A Mythical Machine comes Alive
aslander
0
230
Featured
See All Featured
WENDY [Excerpt]
tessaabrams
9
37k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
260
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.4k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
The Spectacular Lies of Maps
axbom
PRO
1
660
Everyday Curiosity
cassininazir
0
180
Leo the Paperboy
mayatellez
5
1.6k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
Building the Perfect Custom Keyboard
takai
2
720
The Cult of Friendly URLs
andyhume
79
6.8k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.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