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
530
The Shining / ~all work and no play makes jack a dull boy~
kakerukaeru
0
330
AmebaとCDNのお付き合いの歴史 / ameba cdn waiwai
kakerukaeru
0
100
fastlyでええかんじにサイトリニューアル @ Yamagoya Meetup 2018 / e-kanzi Website renewal with fastly
kakerukaeru
0
490
ghe_ameba_arekore
kakerukaeru
2
2.1k
20160907_Akamai_Tech_Deep_Dive
kakerukaeru
0
2.1k
はじめるCassandra
kakerukaeru
1
290
Other Decks in Technology
See All in Technology
適材適所の技術選定 〜GraphQL・REST API・tRPC〜 / Optimal Technology Selection
kakehashi
1
470
エンジニア人生の拡張性を高める 「探索型キャリア設計」の提案
tenshoku_draft
1
130
Terraform未経験の御様に対してどの ように導⼊を進めていったか
tkikuchi
2
430
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
110
AGIについてChatGPTに聞いてみた
blueb
0
130
OCI 運用監視サービス 概要
oracle4engineer
PRO
0
4.8k
The Role of Developer Relations in AI Product Success.
giftojabu1
0
130
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
28
13k
Shopifyアプリ開発における Shopifyの機能活用
sonatard
4
250
【Startup CTO of the Year 2024 / Audience Award】アセンド取締役CTO 丹羽健
niwatakeru
0
1k
20241120_JAWS_東京_ランチタイムLT#17_AWS認定全冠の先へ
tsumita
2
270
OTelCol_TailSampling_and_SpanMetrics
gumamon
1
160
Featured
See All Featured
What's new in Ruby 2.0
geeforr
343
31k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Done Done
chrislema
181
16k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Code Review Best Practice
trishagee
64
17k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
RailsConf 2023
tenderlove
29
900
A Modern Web Designer's Workflow
chriscoyier
693
190k
A better future with KSS
kneath
238
17k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
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ഁյϥΠϑΛʂ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠