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
誰も全体を知らない ~ ロールの垣根を超えて引き上げる開発生産性 / Boosting Development Productivity Across Roles
kakehashi
1
230
Security-JAWS【第35回】勉強会クラウドにおけるマルウェアやコンテンツ改ざんへの対策
4su_para
0
180
DynamoDB でスロットリングが発生したとき/when_throttling_occurs_in_dynamodb_short
emiki
0
250
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
CysharpのOSS群から見るModern C#の現在地
neuecc
2
3.5k
The Role of Developer Relations in AI Product Success.
giftojabu1
0
130
TanStack Routerに移行するのかい しないのかい、どっちなんだい! / Are you going to migrate to TanStack Router or not? Which one is it?
kaminashi
0
600
VideoMamba: State Space Model for Efficient Video Understanding
chou500
0
190
Engineer Career Talk
lycorp_recruit_jp
0
190
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
210
強いチームと開発生産性
onk
PRO
35
11k
iOS/Androidで同じUI体験をネ イティブで作成する際に気をつ けたい落とし穴
fumiyasac0921
1
110
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Designing the Hi-DPI Web
ddemaree
280
34k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Scaling GitHub
holman
458
140k
Building Adaptive Systems
keathley
38
2.3k
Code Review Best Practice
trishagee
64
17k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
130
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Music & Morning Musume
bryan
46
6.2k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
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ഁյϥΠϑΛʂ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠