Slide 1

Slide 1 text

࠷ۙͷ؂ࢹ(Ծ) Mackerel Day #2 kazeburo

Slide 2

Slide 2 text

Me • Masahiro Nagano • @kazeburo • Mackerel Ξϯόαμʔ • Ұ൪޷͖ͳ mackerelϓϥάΠϯ͸ mackerel-plugin-axslog (ࣗ࡞)ͩͳɻ໾ ʹཱͭͱ͜ΖͰ͸ diff-detector(ࣗ࡞)

Slide 3

Slide 3 text

https://ihara2525.tumblr.com/ “Ұߦͷϩάͷ޲͜͏ʹ͸ɺҰਓͷϢʔβ͕͍Δ”

Slide 4

Slide 4 text

• Τϥʔ͸όδΣοτͱ͍͏ߟ͑ • ࢒೦ʹࢥ͏ϢʔβΛগͳ͍͖͍ͯͨ͘͠ • ؂ࢹ͸Ϣʔβͷظ଴ʹԠ͑ΔͨΊͷπʔϧ

Slide 5

Slide 5 text

• ʮ؂ࢹʯʹΑΓ • ো֐Λະવʹ๷͙ • ো֐ʹૉૣ͘ؾͮ͘ • ো֐ͷݪҼಛఆͷώϯτ/MTTRͷ୹ॖ

Slide 6

Slide 6 text

mackerel-plugin-axslog ͱ೿ੜ

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

• mackerel-plugin-axslog • https://github.com/kazeburo/mackerel-plugin-axslog • mackerel-plugin-accesslog ͱಉ͘͡accesslogͷՄࢹԽ • status͝ͱͷ਺ͱׂ߹ɺresponse timeͷpercentile஋Λܭଌ • ूܭ͢ΔlabelΛมߋՄೳɾJSONαϙʔτ • ߴ଎

Slide 9

Slide 9 text

0 2 4 6 8 accesslog(ltsv) axslog(ltsv) axslog(json) 1.17s 0.584s 7.976s 120ສߦ(20000req/sec)ͷϩάΛॲཧ͢Δ࣌ؒ

Slide 10

Slide 10 text

• ߴ଎Խͷར఺ • γεςϜෛՙΛؾʹͤͣɺʮΨϯΨϯʯϝτϦΫεΛ૿΍ͤΔ • ϑΟϧλػೳͷ௥Ճ

Slide 11

Slide 11 text

[plugin.metrics.axslog-web-googlebot] command = "/usr/local/bin/mackerel-plugin-axslog --key-prefix=googlebot \
 --logfile /var/log/nginx/access.log --filter Googlebot" [plugin.metrics.axslog-web-adsbot] command = "/usr/local/bin/mackerel-plugin-axslog --key-prefix=adsbot \
 --logfile /var/log/nginx/access.log --filter AdsBot-Google"

Slide 12

Slide 12 text

• mackerel-plugin-postfix-log • https://github.com/kazeburo/mackerel-plugin-postfix-log • SMTP • AxlogͰlogrotateΛ௥ै͢Δίʔυॻ͍ͨͷͰ͙͢Ͱ͖ͨ

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

postfixlog.total_delay.average 0.240476 1555681849 postfixlog.total_delay.99_percentile 0.250000 1555681849 postfixlog.total_delay.95_percentile 0.240000 1555681849 postfixlog.total_delay.90_percentile 0.240000 1555681849 postfixlog.recving_delay.average 0.040000 1555681849 postfixlog.recving_delay.99_percentile 0.040000 1555681849 postfixlog.recving_delay.95_percentile 0.040000 1555681849 postfixlog.recving_delay.90_percentile 0.040000 1555681849 postfixlog.queuing_delay.average 0.000476 1555681849 postfixlog.queuing_delay.99_percentile 0.010000 1555681849 postfixlog.queuing_delay.95_percentile 0.000000 1555681849 postfixlog.queuing_delay.90_percentile 0.000000 1555681849 postfixlog.connection_delay.average 0.090000 1555681849 postfixlog.connection_delay.99_percentile 0.090000 1555681849 postfixlog.connection_delay.95_percentile 0.090000 1555681849 postfixlog.connection_delay.90_percentile 0.090000 1555681849 postfixlog.transmission_delay.average 0.090000 1555681849 postfixlog.transmission_delay.99_percentile 0.090000 1555681849 postfixlog.transmission_delay.95_percentile 0.090000 1555681849 postfixlog.transmission_delay.90_percentile 0.090000 1555681849 postfixlog.transfer_num.2xx_count 1.615385 1555681849 postfixlog.transfer_num.4xx_count 0.000000 1555681849 postfixlog.transfer_num.5xx_count 0.000000 1555681849 postfixlog.transfer_total.count 1.615385 1555681849 postfixlog.transfer_ratio.2xx_percentage 100.000000 1555681849 postfixlog.transfer_ratio.4xx_percentage 0.000000 1555681849 postfixlog.transfer_ratio.5xx_percentage 0.000000 1555681849 ड৴࣌ͷ஗Ԇ Ωϡʔʹೖ͍ͬͯΔ࣌ؒ ૹ৴ઌ΁ͷ઀ଓʹ͔͔Δ࣌ؒ ૹ৴ͷ஗Ԇ

Slide 15

Slide 15 text

• mackerel-plugin-log-incr-rate • https://github.com/kazeburo/mackerel-plugin-log-incr-rate • ͋Δϩάʹର͢Δผͷϩάͷߦ਺ͷ૿Ճׂ߹Λ؂ࢹ͢Δ • accesslogʹର͢Δapplication_log, errorlogͷ݅਺ͳͲ • application_log΁ͷॻ͖ࠐΈ͕രൃͯ͠ϩάܭଌʹӨڹͨ͠ো֐ʹର͢Δ؂ࢹ

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

• mackerel-plugin-gzip-response • Not OSS • ϨεϙϯεͷGzipѹॖ͕ߦΘΕ͍ͯΔ͔؂ࢹ • Ұ෦ΫϥΠΞϯτͷ࣮૷ͰGzip͕ແޮʹͳͬͨ··ɺେ͖ͳ഑৴ͱͳΔϚε λʔߋ৽͕ߦΘΕɺωοτϫʔΫʹෛՙ͕͔͔Δࣄଶ͕͋ͬͨ • ϩάʹϨεϙϯεͷ Conent-Encoding ϔομΛه࿥͠ूܭ

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

• Mackerel Plugin ࡞੒ύλʔϯ • ো֐/ো֐ʹܨ͕Δ໰୊ͷൃݟ • Metrics Plugin ͷ࡞੒ͱαʔό΁ͷ൓ө • ਺೔MetricsΛΈͯͷɺᮢ஋ઃఆɾਵ࣌ݟ௚͠

Slide 20

Slide 20 text

DB ӡ༻ͱ؂ࢹ

Slide 21

Slide 21 text

• ϗετͷεςʔλεΛ؂ࢹ͢Δ • ϗετεςʔλε Standby ͷDB(slave)αʔόΛ production ʹ౤ೖ • ϝϯςφϯε࡞ۀͷͨΊϨϓϦέʔγϣϯ͕ࢭ·͍͕ͬͯͨɺ௨஌͸དྷͳ͍

Slide 22

Slide 22 text

App App consul consul DNS consul consul 1) look up DNS 2) connect DB check mysql uptime before slave slave slave

Slide 23

Slide 23 text

App App consul consul DNS consul consul 1) look up DNS 2) connect DB A) check mysql uptime After Mackerel batch batch batch B) check host status file B’ ) update host status file by cron slave slave slave

Slide 24

Slide 24 text

• Consul ͷαʔϏε͕༗ޮʹͳΔͨΊʹ͸ɺmackerelͷεςʔλεͷมߋ͕ ඞཁɻΞϥʔτʹؾ͕ͭ͘Մೳੑˢ • ϗετεςʔλεΛϩʔΧϧͷͲ͔͜ʹॻ͖ࠐΉػೳɺ
 mackerel-agent ʹ͋Δͱศར?

Slide 25

Slide 25 text

• Slave Ͱͷ Trigger ࣮ߦΛकΔ • ProductionͷҰ෦ͷslaveΛɺௐࠪɾूܭ༻ͱͯ͠࢖͑ΔΑ͏ʹ͍ͯ͠Δ • ηϯγςΟϒͳ৘ใʹ͍ͭͯ͸Slave্ͷTriggerͰ࡟আ

Slide 26

Slide 26 text

• MySQLͱϨϓϦέʔγϣϯͱTrigger • MySQLͷϨϓϦέʔγϣϯͷํࣜʹ͸SQL͕సૹ͞Εͯ͘ΔStatementํࣜͱɺ σʔλ͕ૹΒΕͯ͘ΔRow Basedํࣜɺ·ͨͲͪΒ͔͕ࣗಈͰબ୒͞ΕΔMixed ํ͕ࣜ͋ΔɻMixedํࣜͰ͸جຊ͸Statementํ͕ࣜͩɺඇܾఆੑΫΤϦ͕࢖Θ ΕΔͱɺRow BasedͱͳΔ • ϨϓϦέʔγϣϯΛड͚Δslaveαʔό্ͰͷTrigger͸ɺStatementํࣜͷ৔߹ͷ Έ࣮ߦ͞ΕΔ • SlaveͰtriggerΛ҆શʹར༻͢ΔͨΊʹ͸ҙਤ͠ͳ͍ Row basedͳϨϓϦέʔ γϣϯΛൃݟ͢Δඞཁ͕͋Δ

Slide 27

Slide 27 text

• check-mysqlbinlog-rbr-fallbacks • No OSS • mysqlbinlog ίϚϯυ࢖͍ɺRow BasedʹͳͬͨςʔϒϧΛݕग़

Slide 28

Slide 28 text

Master Backup Anon Slave Trigger binlog binlog check-mysqlbinlog-rbr-fallbacks Detect the SQL and fix data and 
 applications if necessary App

Slide 29

Slide 29 text

• ௅ઓ͍ͯ͠ΔݶΓɺ؂ࢹ͸૿͑Δ • Application Server: 175 Metrics • DB Server: 245 Metrics

Slide 30

Slide 30 text

• Ҏ্