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
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Building Your Own Lightsaber
phodgson
102
6.1k
Designing for humans not robots
tammielis
249
25k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Facilitating Awesome Meetings
lara
49
6.1k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Gamification - CAS2011
davidbonilla
80
5k
Statistics for Hackers
jakevdp
796
220k
What's new in Ruby 2.0
geeforr
343
31k
Why You Should Never Use an ORM
jnunemaker
PRO
54
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༵