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.9k
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.3k
事業と歩む Ameba システム刷新の道 / the-road-to-ameba-system-renovation-aws-summit-online
kakerukaeru
0
1.8k
事業と歩むAmebaシステム刷新の道 / the-road-to-ameba-system-renovation-cadc
kakerukaeru
0
570
The Shining / ~all work and no play makes jack a dull boy~
kakerukaeru
0
350
AmebaとCDNのお付き合いの歴史 / ameba cdn waiwai
kakerukaeru
0
100
fastlyでええかんじにサイトリニューアル @ Yamagoya Meetup 2018 / e-kanzi Website renewal with fastly
kakerukaeru
0
500
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
フロントエンド設計にモブ設計を導入してみた / 20241212_cloudsign_TechFrontMeetup
bengo4com
0
1.9k
Qiita埋め込み用スライド
naoki_0531
0
1.3k
コンテナセキュリティのためのLandlock入門
nullpo_head
2
320
LINEヤフーのフロントエンド組織・体制の紹介【24年12月】
lycorp_recruit_jp
0
530
LINEスキマニにおけるフロントエンド開発
lycorptech_jp
PRO
0
330
Storage Browser for Amazon S3
miu_crescent
1
140
watsonx.ai Dojo #5 ファインチューニングとInstructLAB
oniak3ibm
PRO
0
160
C++26 エラー性動作
faithandbrave
2
710
レンジャーシステムズ | 会社紹介(採用ピッチ)
rssytems
0
150
Snykで始めるセキュリティ担当者とSREと開発者が楽になる脆弱性対応 / Getting started with Snyk Vulnerability Response
yamaguchitk333
2
180
AI時代のデータセンターネットワーク
lycorptech_jp
PRO
1
280
サービスでLLMを採用したばっかりに振り回され続けたこの一年のあれやこれや
segavvy
2
390
Featured
See All Featured
A Tale of Four Properties
chriscoyier
157
23k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Optimizing for Happiness
mojombo
376
70k
Building Applications with DynamoDB
mza
91
6.1k
RailsConf 2023
tenderlove
29
940
Optimising Largest Contentful Paint
csswizardry
33
3k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
Speed Design
sergeychernyshev
25
670
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Embracing the Ebb and Flow
colly
84
4.5k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
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ഁյϥΠϑΛʂ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠