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
How to Ace a Technical Interview
jacobian
276
23k
Designing for Performance
lara
604
68k
Bash Introduction
62gerente
608
210k
Imperfection Machines: The Place of Print at Facebook
scottboms
264
13k
Automating Front-end Workflow
addyosmani
1366
200k
Docker and Python
trallard
40
3.1k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Designing for humans not robots
tammielis
249
25k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
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༵