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
Lambda management with ecspresso and Terraform
ijin
2
210
Vibe Coding Tools
ijin
2
400
My small contributions - Fujiwara Tech Conference 2025
ijin
0
4.3k
re:Invent 2024体験談〜Interactivity/Community編〜
ijin
0
37
Fastest AWS re:Invent 2024 re:Cap in the galaxy
ijin
0
28
AWS Management Services
ijin
0
30
Fastest AWS re:Invent 2019 story in the galaxy
ijin
0
170
My DevOps toolsets
ijin
1
1.6k
Serverless Communities (AWS Users Group Netherlands)
ijin
0
70
Other Decks in Technology
See All in Technology
GPUをつかってベクトル検索を扱う手法のお話し~NVIDIA cuVSとCAGRA~
fshuhe
0
350
Open Table Format (OTF) が必要になった背景とその機能 (2025.10.28)
simosako
3
600
AIの個性を理解し、指揮する
shoota
3
610
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
2
220
初海外がre:Inventだった人間の感じたこと
tommy0124
1
180
ソースを読む時の思考プロセスの例-MkDocs
sat
PRO
1
360
[Journal club] Thinking in Space: How Multimodal Large Language Models See, Remember, and Recall Spaces
keio_smilab
PRO
0
110
abema-trace-sampling-observability-cost-optimization
tetsuya28
0
440
日本のソブリンAIを支えるエヌビディアの生成AIエコシステム
acceleratedmu3n
0
110
猫でもわかるAmazon Q Developer CLI 解体新書
kentapapa
1
260
Boxを“使われる場”にする統制と自動化の仕組み
demaecan
0
100
2025/10/27 JJUGナイトセミナー WildFlyとQuarkusの 始め方
megascus
0
110
Featured
See All Featured
BBQ
matthewcrist
89
9.9k
Making the Leap to Tech Lead
cromwellryan
135
9.6k
Agile that works and the tools we love
rasmusluckow
331
21k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
23
1.5k
Site-Speed That Sticks
csswizardry
13
940
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
192
56k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6k
The Cost Of JavaScript in 2023
addyosmani
55
9.1k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.7k
Building a Scalable Design System with Sketch
lauravandoore
463
33k
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