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
Optimising Largest Contentful Paint
csswizardry
33
3k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
247
1.3M
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
A Philosophy of Restraint
colly
203
16k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Automating Front-end Workflow
addyosmani
1366
200k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
Embracing the Ebb and Flow
colly
84
4.5k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
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༵