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
2012-04-19-mysql-casual-vol3.pdf
Search
Akira Maeda
April 19, 2012
0
8.5k
2012-04-19-mysql-casual-vol3.pdf
Akira Maeda
April 19, 2012
Tweet
Share
More Decks by Akira Maeda
See All by Akira Maeda
Dockerホットデプロイ運用の話 / Operations for Zero Downtime Docker Deployment
glidenote
4
3k
Working With Terraform
glidenote
3
9k
Sensu Deep Talks #1
glidenote
14
3.2k
vim study vol.2
glidenote
1
160
octopress
glidenote
3
2.9k
paperboy.el
glidenote
1
4.2k
Terminal Study vol.2
glidenote
3
6.3k
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
693
190k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Speed Design
sergeychernyshev
24
610
It's Worth the Effort
3n
183
27k
Happy Clients
brianwarren
98
6.7k
KATA
mclloyd
29
14k
Writing Fast Ruby
sferik
627
61k
10 Git Anti Patterns You Should be Aware of
lemiorhan
654
59k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
Side Projects
sachag
452
42k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
Transcript
ϨϓϦέʔγϣϯΤϥʔ͔ΒࣗಈͰ෮چ MySQL Casual Talks Vol.3 (2012-04-19) @glidenote 124݄19༵
ࣗݾհ • @glidenote(άϥΠυϊʔτ) • લా ষ / Akira Maeda •
paperboy&co. ͷΠϯϑϥΤϯδχΞ • http://blog.glidenote.com/ • ࣾҰͷλʔϛφϧڰɻԿͰCUIɻ • MySQLͷϨϕϧ˒ˑˑˑˑˑˑˑˑˑ • ϖύϘMySQL࢛ఱԦͷதͰ࠷ऑ 124݄19༵
ૣຊʹ 124݄19༵
͋Δͷग़དྷࣄ 124݄19༵
εϨʔϒαʔόͷϨϓϦέʔγϣϯ͕Ұ੪ఀࢭ Master Slave 20ऑ … 124݄19༵
෮چͷͨΊͷରԠͱௐࠪ1 • ΤϥʔϩάͰάάͬͨΒͲ͏ΒMySQLͷό άʹىҼ͢Δࣄ • MySQLͷόʔδϣϯΞοϓͰΔΒ͍͠ • SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
ΛԿճ͔ൃߦ 124݄19༵
ͱΓ͋͑ͣ෮چɻ 124݄19༵
ͦͷͷ༦ํ 124݄19༵
·ͨεϨʔϒαʔόͷϨϓϦέʔγϣϯҰ੪ఀࢭ Master Slave 20ऑ … 124݄19༵
෮چͷͨΊͷରԠͱௐࠪ2 • ·ͨSET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; ΛԿճ͔ൃߦ ͯ͠ͱΓ͋͑ͣશ෮چ • Ͱোݕ͔Β෮چ·Ͱ࠷Ͱ10͘Β͍ ͔͔Δ(εϨʔϒαʔό20ऑ)
• ͜ͷରԠํ๏·͍ͣ͠ɺslave-skip-errorsӡ ༻ํͱͯ͠ར༻ͨ͘͠ͳ͍... 124݄19༵
ͦ͜Ͱొ͢Δͷ͕ 124݄19༵
mk-slave-restart • ݴΘͣͱΕͨmaatkitͷ1πʔϧ • ಛఆͷΤϥʔΛແݶεΩοϓͯ͠ϨϓϦ έʔγϣϯΛ࠶։ͯ͘͠ΕΔ • mk-slave-restart -uhoge -pxxxx
--error- numbers 1100 --verbose 124݄19༵
mk-slave-restartΛͬͯ... • SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; ͰͷରԠʹൺΔͱᴴ͔ʹૣ͍ • Ͱ֤αʔόͰ1ͣͭ֬ೝ͠ͳ͕Β࣮ߦͯ͠ ͍ͨͷͰɺରԠૣ͘ͳ͚ͬͨͲखಈରԠ มΘΒͳ͍
• mk-slave-restartͷ࣮ߦΛࣗಈԽ͍ͨ͠!! 124݄19༵
ͦ͜Ͱొ͢Δͷ͕ 124݄19༵
• IBMۘϩάࢹπʔϧ • PerlͰॻ͔Ε͍ͯΔ • εΫϦϓτຊମɺઃఆϑΝΠϧɺىಈεΫϦ ϓτͷ3ݸ͔Βߏ • ઃஔɺઃఆָ͕(swatchΑΓָͩͱࢥ͍·͢) logmon
124݄19༵
ઃఆϑΝΠϧlogmon.confͷॻ͖ํ :/var/lib/mysql/err.log ←ࢹରͷϩά (Error_code: 1100) ←ࢹରͷจࣈྻ mk-slave-restart -uhoge --error-numbers 1100
--verbose - pxxxx >> /var/lib/mysql/skip_query.log ←จࣈྻΛൃݟͨ͠ͱ͖࣮ߦ ͢ΔίϚϯυ 3ߦ͕جຊηοτ ࠓճͷઃఆྫ :ࢹରͷϩά (ࢹରͷจࣈྻ) จࣈྻΛൃݟͨ͠ͱ͖࣮ߦ͢ΔίϚϯυ(࣮ߦίϚϯυߦෳߦՄ) 124݄19༵
logmonͰΤϥʔࢹ • ϨϓϦέʔγϣϯ͕ࢦఆΤϥʔͰࢭ·ͬͨΒɺmk-slave- restartࣗಈͰൃಈ • ࣮ӡ༻Ͱmk-slave-restartͷ࣮ߦ͚ͩͰͳ͘ɺࣾ IRCɺϝʔϧͰͷ௨ • logmon͕མͪͯͯಇ͔ͳ͔ͬͨ͜ͱ͕͋ΔͷͰࠓ SupervisordͰσʔϞϯཧ
• ผ݅Ͱ͕͢RAIDίϯτϩʔϥશจݕࡧͰར༻͍ͯ͠ ͨTrittonͷIndex͕յΕΔෆ۩߹logmonͰࢹͯ͠· ͢ 124݄19༵
·ͱΊ • ϨϓϦέʔγϣϯΤϥʔʹmk-slave- restart • ϩάࢹʹlogmon • mk-slave-restart + logmonͰϨϓϦέʔ
γϣϯΤϥʔ͔Βࣗಈ෮چ 124݄19༵
MySQLͷӡ༻ָΛ͠·͠ΐ͏ 124݄19༵
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ 124݄19༵