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
3.1k
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
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.2k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Site-Speed That Sticks
csswizardry
2
190
The Cult of Friendly URLs
andyhume
78
6.1k
KATA
mclloyd
29
14k
Scaling GitHub
holman
458
140k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
Agile that works and the tools we love
rasmusluckow
328
21k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
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༵