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
Continuous Restoreへの道
Search
kakerukaeru
December 12, 2014
Technology
4
6.8k
Continuous Restoreへの道
MySQL Casual Talks vol.7 でしゃべった奴
kakerukaeru
December 12, 2014
Tweet
Share
More Decks by kakerukaeru
See All by kakerukaeru
大規模ImageOptimizer利用案件から学ぶ 安心安全のCDN移行 / Fastly yamagoya 2022
kakerukaeru
1
1.2k
事業と歩む Ameba システム刷新の道 / the-road-to-ameba-system-renovation-aws-summit-online
kakerukaeru
0
1.7k
事業と歩むAmebaシステム刷新の道 / the-road-to-ameba-system-renovation-cadc
kakerukaeru
0
510
The Shining / ~all work and no play makes jack a dull boy~
kakerukaeru
0
320
AmebaとCDNのお付き合いの歴史 / ameba cdn waiwai
kakerukaeru
0
99
fastlyでええかんじにサイトリニューアル @ Yamagoya Meetup 2018 / e-kanzi Website renewal with fastly
kakerukaeru
0
480
ghe_ameba_arekore
kakerukaeru
2
2.1k
20160907_Akamai_Tech_Deep_Dive
kakerukaeru
0
2.1k
はじめるCassandra
kakerukaeru
1
280
Other Decks in Technology
See All in Technology
KDD2024参加報告
cyberagentdevelopers
PRO
1
220
【shownet.conf_】革新と伝統を融合したファシリティ
shownet
PRO
0
250
Azure Verified Moduleを触って分かった注目ポイント/azure-verified-module-begin
mhrtech
1
160
PREEMPT_RT over the years
ennael
PRO
0
320
【shownet.conf_】クロージングセッション
shownet
PRO
0
230
【shownet.conf_】ShowNet 2024 ~ Inter * Network ~
shownet
PRO
0
390
【shownet.conf_】放送局とShowNetが共創する、未来の放送システム ~Media over IP 特別企画の裏側~
shownet
PRO
0
270
How CERN serves 1EB of data via FUSE
ennael
PRO
0
16k
【shownet.conf_】ローカル5Gを活用したウォーキングツアーの体感向上
shownet
PRO
0
250
いまからでも遅くない! コンテナでWebアプリケーションを 動かしてみよう(2-1)WebAPI座学
nomu
0
150
Assisted reorganization of data structures
ennael
PRO
0
220
マーケットプレイス版Oracle WebCenter Content For OCI
oracle4engineer
PRO
2
200
Featured
See All Featured
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Six Lessons from altMBA
skipperchong
26
3.4k
Building a Modern Day E-commerce SEO Strategy
aleyda
37
6.8k
[RailsConf 2023] Rails as a piece of cake
palkan
49
4.7k
Building Adaptive Systems
keathley
37
2.1k
KATA
mclloyd
27
13k
Bash Introduction
62gerente
608
210k
Making Projects Easy
brettharned
114
5.8k
Building Better People: How to give real-time feedback that sticks.
wjessup
360
19k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
1
240
Build your cross-platform service in a week with App Engine
jlugia
229
18k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
45
4.9k
Transcript
Continuous Restoreͷಓ
MySQLCasualͳͷʹ Casual͡Όͳͯ͘ࢮʹͦ ͏Ͱ͢
͍
who are you
͍Θͳ͕͔͚Δ @kakerukaeru ΏͱΓΠϯϑϥԂࣇʹ͋ AmebaεϚϗϓϥοτϑΥʔϜ໘ݟΔϚϯ Amebaը૾৴Ϛϯ ࠷ۙྑ͘৮ͬͯΔσʔλετΞCassandra ΦΤʔʔ!!!!ɹʊʊ_ ɹɹɹ ʊʊ_ʗɹɹ ʋ
ɹɹ ʗɹ ʗɹʗ˶ʋ| ɹɹ/ (ƅ)/ɹʗ /
about Cyberagent
game
pigg
blog
Community
MySQL͍ͬͺ͍ͬͯΔΑ
͍
agenda
• ܧଓతΓ͢ͱ͋ͬͯΈͨ • Ͳ͏࣮ݱ͔ͨ͠ • BackupϚσ • RestoreϚσ • ͏ͪΐͬͱߟ͑Δ
• ͬͯΈͨॴײ • ࠓޙ
ܧଓత Γ͢ͱ͋ͬͯΈͨ
Έͳ͞·
ෆ҆ʹͳͬͨ͜ͱ͋Γ ·ͤΜ͔
ྫ͑
SlaveશͰແݶ࠶ىಈ SlaveҰؾʹམ1 1 ͱ͋ΔDeleteจൃߦˠmysqldམͪΔˠmysqldsafeܦ༝Ͱ্͕ΔˠϨϓϦ࠶։ͰDeleteจൃߦˠmysqldམͪΔˠmysqldsafe(ry
͘͠
͓͔ͪΌΜ͕ ຊ൪DBͰDROP DATABASE2 2 ࡢຊʹ͋ͬͨࣄ݅
ͳ͍͔ (ʈТʈ) ⊃ɹ㱬
͋Δͱ͢Δ͡ΌΖʁ (ʈТʈ) ⊃ɹ㱬
ͦΜͳ͜ΜͳͰ
ʊਓਓਓਓਓਓʊ ʼɹ MySQL܈ɹʻ ʼɹ ಥવͷࢮ ɹʻ ʉY^Y^Y^Y^Yʉ
͜Μͳࣄ͋Ζ͏͔ͱ
ͬͯͯΑ͔ͬͨ BACKUP
Ͱ
͜Εຊʹrestoreग़དྷΔͷʁ
͠ग़དྷͳ͔ͬͨΒͲ͏͠Α͏ɾɾɾ
ΓϚελʔ͚ͩɾɾɾ
ՔಇதͷϚελʔ͔Β σʔλൈ͖ग़͢ࣄʹɾɾɾ
ࣦഊͨ͠ΒͲ͏͠Α
͜Μͳෆ҆ʹ·͞Εͳ͍ͨΊʹ
Backupͷਖ਼ੑʁͷ୲อΛ͓͖͍ͯͨ͠
ͰɺखͰຖճ֬ೝ͢Δͷɾɾɾ
ࣗಈԽͪ͠Ό͍ͳyo
Ͳ͏࣮ݱ͔ͨ͠
Backup·ͰͷྲྀΕ
None
Backup • backup༻slave • backup༻server • backup_serverΑΓ • ఆظxtrabackup •
ਵ࣌binlog_sync
ϦετΞ·ͰͷྲྀΕ
None
Restore • APIܦ༝Ͱinstance࡞ • chef-soloʹͯmysql_setup • BackupαʔόΑΓ࠷৽ͷsnapshotͱbinlogΛసૹ • test-serverͰrestoreॲཧ •
instanceআ
͜ΕͰRestoreͷ୲อ͕ग़དྷͨ
͍ͭͳΜͲ͖αʔό͕ࢮ ΜͰେৎ _(ˇωˇʯ㲃)_ ţźō…
͏ͪΐͬͱߟ͑Δ
ԿΛͬͯϦετΞྃͱ͢Δ͔
ۭͬΆͷςʔϒϧ͕ Restore͞Εͯҙຯͳ͍
ͳͷͰRestoreͷਖ਼ੑʁ ୲อͯ͋͛͠Α͏
Ͳ͜·ͰΔ͔
backup༻ͷSlaveͱ restore͞ΕͨDBͷ߹ੑΛߟ͑Δ
ͭ·Γʁ
BackupલͱRestoreޙͷ֬ೝ߲ʹ diff͕ͳ͍͜ͱΛ֬ೝ
֬ೝ߲ɺԿ͕͋Δ͔ͳʔ • ςʔϒϧഁଛ͕ͳ͍ࣄ • ςʔϒϧͷத͕Ұக͍ͯ͠Δ͜ͱ • ςʔϒϧఆ͕ٛҰக͍ͯ͠Δ͜ͱ • index͕Ұக͍ͯ͠Δ͜ͱ mysqlcheck
--all-databases CHECKSUM TABLE hogehoge SHOW CREATE TABLE hogehoge SHOW INDEXES FROM hogehoge
͜ΕΛ౿·্͑ͨͰcheckͷྲྀΕ
None
None
None
None
None
None
None
None
None
None
• stop Replication • pre_checksum • checksum table,show create table,show
indexes from • backup • start Replication • restore • diff pre_checksum • mysqlcheck
ͨͩ
ຖճ͜ͷchecksumΛྲྀ͢ͱ ͕͔͔࣌ؒΓ͗͢Δ
ͷͰ
࣮ࡍͷӡ༻Ͱ̎छྨʹ͚͍ͯ·͢
• ຖճ࣮ߦ • ςʔϒϧഁଛ͕ͳ͍ࣄ • िҰcheck • ςʔϒϧഁଛ͕ͳ͍ࣄ • ςʔϒϧͷத͕Ұக͍ͯ͠Δ͜ͱ
• ςʔϒϧఆ͕ٛҰக͍ͯ͠Δ͜ͱ • index͕Ұக͍ͯ͠Δ͜ͱ
͜ΕͰdataͷਖ਼ੑ ͋Δఔ୲อͰ͖͔ͨͳ
None
Θ͊ɺಈ͍ͯΔ ͭͳ͗ࠐΈͯ͠શମͰಈ͍ͨͷ͍͖ͭͬ͞
҆৺ͯ͠৸ΕΔ ( ˘ω˘ ) ţźō…
ͬͯΈͨॴײ
ਖ਼ࡢՔಇ࢝͠Ί͔͔ͨͬͩΒ·ͩײͳ͍ খཻͳͷ͔Βେཻͳͷ·Ͱ༷ʑͳαʔϏε͕ཚཱͯ͠Δঢ় گͰɺ̍αʔϏεͣͭrestoreग़དྷΔ͔ͷ֬ೝΛ৺Թ·Δख࡞ۀ Ͱ֬ೝ͠ͳͯ͘ྑ͘ͳͬͨͱ͍͏ਫ਼ਆతͳ҆Β͗Λಘͨɻ ͋ͱɺ͜Ε͙Β͍ͷ༰ྔͩͱRestoreʹͲΕ͙Β͍ͷ͕͔͔࣌ؒ Δ͔ͱ͔͕͔ͬͨΓͯͪ͠ΐͬͱָ͍͠
ࠓޙ
ෆ҆ɺվળ • check߲ͬͱ٧ΊΕΔؾ͕͢Δ • ϚαΧϦ͚Εخ͍͠Ͱ͢(;д) • ͿͬͪΌ͚·ͩ̏Service͙Β͍Ͱ͔͠Քಇͯ͠ͳ͍ • ͲΜͲΜՃ͍ͯ͘͠ •
·ͩ100GB͙Β͍·Ͱͷ༰ྔͷrestore͔ͯ͠͠ͳ͍ • ༰ྔ૿͖͑ͯͨΒࠓͷcheckͩͱऴΘΒͳ͍ؾͯ͠Δ
·ͱΊ
Backup୲อʹΑΓ
շదͳDBഁյϥΠϑΛʂ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠