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.6k
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
My small contributions - Fujiwara Tech Conference 2025
ijin
0
3.2k
re:Invent 2024体験談〜Interactivity/Community編〜
ijin
0
6
Fastest AWS re:Invent 2024 re:Cap in the galaxy
ijin
0
6
AWS Management Services
ijin
0
8
Fastest AWS re:Invent 2019 story in the galaxy
ijin
0
150
My DevOps toolsets
ijin
1
1.5k
Serverless Communities (AWS Users Group Netherlands)
ijin
0
48
Serverless Communities (Serverless Days Hamburg 2019)
ijin
0
6.4k
Fastest AWS re:Invent 2018 story in the galaxy
ijin
0
6.3k
Other Decks in Technology
See All in Technology
MIMEと文字コードの闇
hirachan
2
1.4k
Amazon Aurora のバージョンアップ手法について
smt7174
2
150
生成AI×財務経理:PoCで挑むSlack AI Bot開発と現場巻き込みのリアル
pohdccoe
1
740
自分だけの仮想クラスタを高速かつ効率的に作る kubefork
donkomura
0
100
"TEAM"を導入したら最高のエンジニア"Team"を実現できた / Deploying "TEAM" and Building the Best Engineering "Team"
yuj1osm
1
200
What's new in Go 1.24?
ciarana
1
110
AIエージェント開発のノウハウと課題
pharma_x_tech
0
380
RayでPHPのデバッグをちょっと快適にする
muno92
PRO
0
190
DevinでAI AWSエンジニア製造計画 序章 〜CDKを添えて〜/devin-load-to-aws-engineer
tomoki10
0
140
AIエージェント元年@日本生成AIユーザ会
shukob
1
220
【詳説】コンテンツ配信 システムの複数機能 基盤への拡張
hatena
0
260
ABWG2024採択者が語るエンジニアとしての自分自身の見つけ方〜発信して、つながって、世界を広げていく〜
maimyyym
1
180
Featured
See All Featured
Adopting Sorbet at Scale
ufuk
74
9.2k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
30
4.6k
Designing for humans not robots
tammielis
250
25k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
Bootstrapping a Software Product
garrettdimon
PRO
306
110k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
4 Signs Your Business is Dying
shpigford
182
22k
How to Think Like a Performance Engineer
csswizardry
22
1.4k
Typedesign – Prime Four
hannesfritz
40
2.5k
VelocityConf: Rendering Performance Case Studies
addyosmani
328
24k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
7k
Unsuck your backbone
ammeep
669
57k
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