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.4k
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
Fastest AWS re:Invent 2019 story in the galaxy
ijin
0
140
My DevOps toolsets
ijin
1
1.4k
Serverless Communities (AWS Users Group Netherlands)
ijin
0
39
Serverless Communities (Serverless Days Hamburg 2019)
ijin
0
5.8k
Fastest AWS re:Invent 2018 story in the galaxy
ijin
0
5.6k
Accelerating DevOps with Serverless
ijin
0
6.4k
Fastest AWS re:Invent 2017 story in the galaxy
ijin
0
6.1k
Fastest AWS re:Invent 2016 story in the galaxy
ijin
1
7.5k
To DockerCon you go!
ijin
0
3.9k
Other Decks in Technology
See All in Technology
プロデザ! BY リクルート vol.18_リクルートのリサーチ実践組織「リサーチブーストコミュニティ」
recruitengineers
PRO
3
280
Cloud Native Java with Spring Boot (CNCF Aarhus, April 2024)
thomasvitale
1
170
Azure犬駆動開発の記録/GlobalAzureFukuoka2024_20240420
nina01
1
210
DevOpsDays History and my DevOps story
kawaguti
PRO
9
2.5k
20240416_devopsdaystokyo
kzkmaeda
1
220
APIファーストなプロダクトマネジメントの実践 〜SaaSus Platformでの例〜 / "Practicing API-First Product Management - An Example with SaaSus Platform
oztick139
0
100
非同期推論システムによるコスト削減と信頼性向上
koki_nishihara
0
230
チームでロジカルシンキングに改めて向き合っている話 〜学習環境と実践⽅法〜
sansantech
PRO
2
2.1k
検証を通して見えてきたTiDBの性能特性
lycorptech_jp
PRO
6
3.7k
私が trocco を推す理由
__allllllllez__
1
210
リテール金融(キャッシュレス・ネット銀行・ネット証券)の競争環境と経済圏
8maki
0
720
サーバー間 GraphQL と webmock-graphql の話 / server-to-server graphql and webmock-graphql
qsona
2
180
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
60
5k
Atom: Resistance is Futile
akmur
259
25k
From Idea to $5000 a Month in 5 Months
shpigford
377
45k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
322
20k
Designing Experiences People Love
moore
136
23k
4 Signs Your Business is Dying
shpigford
175
21k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
18
6.9k
How to name files
jennybc
65
93k
Rebuilding a faster, lazier Slack
samanthasiow
73
8.2k
Build your cross-platform service in a week with App Engine
jlugia
225
17k
Making the Leap to Tech Lead
cromwellryan
124
8.5k
Product Roadmaps are Hard
iamctodd
44
9.7k
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