Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Suggested Topicの質問に可能な限り答えてみた

Suggested Topicの質問に可能な限り答えてみた

shogomuranushi

August 25, 2020
Tweet

More Decks by shogomuranushi

Other Decks in Technology

Transcript

  1. @rwle1212 3 ໊લ ɿ ଜओ ૖ޛʢΉΒ͵͠ ͠ΐ͏͝ʣ ձࣾ ɿ ABEJA,

    Inc. ۀ຿ ɿΠϯϑϥΤϯδχΞ -> ϓϩμΫτΦʔφʔ -> SRE
  2. @rwle1212 11 ࣦഊྫ1: ݁ہCloudWatchΛݟ͍ͯͨ ALB -> Container -> EC2 ->

    RDSͱ͍͏ϦΫΤετͷྲྀΕͰμογϡϘʔυΛ࡞ͬ ͯΈͨɻ μογϡϘʔυͷେ͖͞͸ܾ·͍ͬͯΔɺ׌ͭάϥϑ͕ଟ͗ͯ͢΋ෳࡶʹͳΔͷ ͰɺεϚʔτʹগͳΊʹάϥϑΛ഑ஔͨ͠ɻ ͔͠͠ো֐࣌ʹ৘ใ͕଍Γͳ͍ͷͰɺ݁ہCloudWatchΛோΊ͍ͯͨ͜ͱʹؾ෇͍ ͨɻ ͔ͦ͜ΒඞཁͳάϥϑΛ଍͍ͯ͘͠ͱͲΜͲΜෳࡶʹͳΓɺଞͷϝϯόʔ͸ʮԿΛ Ͳ͏ݟͨΒྑ͍ͷ͔Θ͔Βͳ͍ʯঢ়ଶʹͳͬͨɻ ݁ہCloudWatchΛோΊ͍ͯͨ͜ͱʹؾ෇͍ͨɻ
  3. @rwle1212 14 ղܾྫ
 NotebookΛ࢖ͬͯΈͨ • Jupyter Notebook Likeͳ࢖͍ํ͕Ͱ͖ ͯɺίϝϯτͱάϥϑΛॻ͚Δ •

    ಛఆͷো֐ʹରͯ͠ௐ΂ͨ͜ͱɺਪଌ ͳͲͷίϝϯτΛॻ͖ͳ͕Βه࿥͕࢒ ͤΔ • ϩάͷάϥϑԽ΋༰қ • Issueʹը૾ΛషΓ෇͚ΔΑΓεϜʔ ζʹ·ͱΊΒΕΔͷͰڞ༗ָ͕͘͢͝
  4. @rwle1212 19 ՝ۚ؅ཧʹؔ͢Δେٕখٕ ಛʹେٕ͸ແ͠ɻখωλ͕͋Δͱͨ͠Β • Multi Org؀ڥ͸Billing͕ू໿͞Εͯ͠·͏ɻʮLast Month’s UsageʯͰར༻ྔʢྉ ۚͰ͸ͳ͍ʣ͕Orgຖʹग़ྗ͞ΕΔͷͰ҈෼͍ͯ͠ΔɻӦۀ͞Μʹݴ͑͹Billing΋

    ෼͚ͯ͘ΕΔ͔΋ʁखؒͳͷͰͦ͜·Ͱ΍ͬͯͳ͍ • AWSΠϯςάϨʔγϣϯͰͨ͘͞ΜͷαʔϏεͷϝτϦΫεΛऔΕΔΑ͏ʹ͢Δ ͱɺCloudWatch ͷ GetMetricData API ͕ΊͪΌͪ͘Όݺͼग़͞ΕΔͷͰ՝͕ۚ େ͖͘૿͑Δɻ·ͣ͸ඞཁͳαʔϏε͚ͩߜͬͯऔΓࠐΉͷ͕٢ɻ
 SQSͰࢮ๢ͨ͠ܦݧ༗Γ
  5. @rwle1212 24 ʲཁ໿ʳͳͥPrometheusΛࣙΊͯDatadogΛ࠾༻ͨ͠ͷ͔ • Datadog͔ΒPrometheus΁৐Γ׵͑ • ݩʑDatadogΛ࢖͍ͬͯͨɻ$18/host͕ߴ͔ͬͨ͠ɺKubernetesͷ؂ࢹͷσϑΝΫ τʹͳΓͭͭ͋ΔPrometheusΛࢼ͢໨త΋ؚΊͯ࢖͍࢝Ίͨɻ • ൒೥ܦաɻPrometheusࣗମͷো֐͕νϥϗϥ

    • OSSͰ৘ใগͳ͍৔߹͸ௐࠪʹ͕͔͔࣌ؒΔɻଟ͍࣌͸िʹ1,2ճ΄Ͳ໰୊͕ൃੜ ͠1,2ਓ͕਺࣌ؒ/ि΄ͲऔΒΕ͍ͯͨ • ελʔτΞοϓ͸ਓ͕͍ͳ͍ɻຊۀͷ։ൃʹूத͍ͨ͠ • πʔϧͷ͓कΓʹ͕࣌ؒऔΒΕ͍ͯͨɻPrometheusͷӡ༻Λ֎෦ʹҕୗ͍ͨ͠ɻ ӡ༻Λ֎෦ʹҕୗ͢Δͱ͍͘ΒʹͳΔ͔෼͔Βͳ͍͚Ͳɺࠓͷن໛ΛDatadogʹม ͑Δͱ10ສ/݄͘Β͍ͩͬͨɻɾɾDatadogͰΑ͘Ͷʁͱࢥ͍࢝ΊΔ
  6. @rwle1212 25 ʲཁ໿ʳͳͥPrometheusΛࣙΊͯDatadogΛ࠾༻ͨ͠ͷ͔ • ϩάͷऩूͲ͏͢Δ໰୊ • CloudWatch LogsΛ࢖͍͕ͬͯͨݕࡧੜօແɻʢ౰࣌͸ʣPrometheus͸ϩάऩू ͢Δػೳ͸ͳ͍ɻσϑΝΫτతʹ͸ ElasticSearch

    + Kibana ͩΖ͏ • ͔͠͠ɺͦͷ࣌఺Ͱϩάྔ͕5ԯ/݄ɻঃʑʹର৅ͷΞϓϦ΍νʔϜΛ૿΍ͦ͏ͱࢥ ͏ͱ਺ϲ݄Ͱഒʑʹ૿͍͑ͯ͘͜ͱ͕૝ఆ͞Ε͍ͯͨ • ͦΕΛElasticSearchͰड͚ͳ͕Βӡ༻͢Δ͜ͱΛ૝ఆ͢Δͱɺख͕औΒΕͦ͏ײ͕ ൒୺ͳ͔ͬͨ • Datadog΋ϩάͷαʔϏεΛఏڙ࢝͠Ί͍ͯͨͷͰ࢖ͬͯΈΔ͜ͱʹ
  7. @rwle1212 26 ʲཁ໿ʳͳͥPrometheusΛࣙΊͯDatadogΛ࠾༻ͨ͠ͷ͔ • ϩάͲ͏͢Δ͔ͷ݁࿦ • Facets ͕ڧྗͰɺಋೖָ͕ɺίετίϯτϩʔϧ΋͠΍͘͢ɺԿ͔͋Ε͹શϩά Λ௥͑Δɻͦͷ্Ͱɺϩάऩू͢Δ্ͰΠϯϑϥΛؾʹ͠ͳͯ͘ྑ͍ͷ͕ؾʹೖ ΓɺঃʑʹϩάΛ

    Datadog Logs ʹدͤ·ͨ͠ • ͦͯ͠ɺϞχλϦϯά΋ Promethes ͔Β Datadog ΁Ҡߦ • ͳͥPrometheusΛࣙΊͯDatadogΛ࠾༻ͨ͠ͷ͔ɺͷ·ͱΊ • ϩά΋ϞχλϦϯά΋ ͦΕ͕ࣄۀͷίΞͰ͋Ε͹ͪΌΜͱߏங͠ӡ༻͢Δ͜ͱࣗ ମ͸ԀΘͳ͍ͷͰ͕͢ɺίΞͰͳ͍ͳΒ࣌ؒΛׂ͖ͨ͘ͳ͍
  8. @rwle1212 31 Datadogͷ෍ڭ׆ಈ ʢͲͷ໾ׂͷΤϯδχΞ·Ͱ࢖͍ͬͯΔ͔ʁʣ • ޮՌ͋·Γͳ͔ͬͨ͜ͱ • Datadogͷ࢖͍ํษڧձɻʮ΁ʔɻ͜Μͳ͜ͱͰ͖ΔΜͩʯͱ͍͏͚ͩͰखΛ ಈ͔͞ͳ͍ͷͰฉ͍ͯ΋๨ΕΔ •

    ϩάɺϝτϦΫεΛՄೳͳݶΓू໿ͯ͠ɺඞཁʹۦΒΕͯࣗ෼Ͱௐ΂ͯ޻ ෉ͯ͠΋Β͏ํ͕͕֮͑ྑͦ͞͏ͳؾ͕ͨ͠ɻݴ͏ͯ΋೉͘͠ͳ͍ͷͰ • ͋Δఔ౓ͨ͠Βʮ͓Εͷ͔Μ͕͍͖͑ͨ͞ΐ͏ͷDatadogڞ༗ձʯΛ֤ϝ ϯόʔͰখωλతʹ΍Δͷ΋ѱ͘͸ͳ͔ͬͨ
  9. @rwle1212 34 Ξϥʔτͷ௨஌Ϩϕϧ؅ཧ ʢฐࣾ͸warn / error / fatal ͳͲʣ •

    WarnͱErrorͷΈ • ʮαʔϏεʹ௚઀Өڹ͕Ͱ͍ͯΔϞϊɺͰ͍ͯΔՄೳੑ͕͋ΔϞϊʯΛΞϥʔτ ͱͯ͠ઃఆ͍ͯ͠Δ • ྫʣCPU΍ϝϞϦͷ࢖༻཰Λ؂ࢹͱ͔͸͍ͯ͠ͳ͍ɻͦΕΒͷӨڹʹΑͬ ͯALBͰ5xx͕සൃ͢Ε͹Ξϥʔτ͕ඈͿΑ͏ʹ͍ͯ͠ΔɻDynamoDBͷ εϩοτϦϯάͱ͔
  10. @rwle1212 38 Graph by Logs • ϩάΛάϥϑԽͰ͖Δ • facetsʹొ࿥ͨ͠஋ΛGroup Byʹࢦఆͨ͠Γɺ

    CountʹೖΕΔ͜ͱ΋Ͱ͖Δ • ࠨਤͷྫͰ͸ɺOrganization NameຖͷϦΫΤ ετ਺΍ฏۉԠ౴࣌ؒͳͲΛදࣔɻίϯςφID ຖʹݟͯภΓ͕ແ͍͔ݟͨΓ΋ͯ͠Δ • γεςϜܥ͚ͩͰ͸ͳ͘ΞϓϦͷར༻ঢ়گ෼ੳ ʹ΋࢖༻ՄೳͳͷͰɺΞϓϦଆͰ޷͖ͳ஋Λग़ ͤ͹৭ʑͳ؍఺Ͱ෼ੳͰ͖Δ • ᮢ஋Λઃ͚ͯΞϥʔτൃ๒Ͱ͖ΔͷͰ1ͭͷγ εςϜͰϝτϦΫεɾϩάͷ؂ࢹΛ؅ཧͰ͖Δ
  11. @rwle1212 39 Graph by Logs • େ͖͍มߋΛͨ࣌͠͸εςʔλείʔυͷׂ߹ Λ֬ೝ • ઃఆํ๏

    • Group By: @http.status_code • Display: Areas • Stacked as: % of overall count: *
  12. @rwle1212 41 Indexes • ϩάऩूͷআ֎ϑΟϧλ͕ॻ͚ΔɻIndexed LogsͰ՝ۚ͞Εͳ͘ͳΔ • 10%͚ͩऔಘ͢Δͱ͍͏͜ͱ΋ՄೳɻΫΤϦͰ ͔ͳΓߜΓࠐΉ͜ͱ͕Ͱ͖Δ •

    ϩάΛૹ৴͢ΔAgent/ClientଆͰίϯτϩʔϧ ͢Δ͜ͱ΋Մೳ͕ͩɺઃఆϑΝΠϧͷ഑෍౳͕ ໘౗ͳͷͰ͍ͬͨΜશ෦Datadogʹ౤͛ͯɺ IndexsͰϩάΛམͱ͢ͱ͍͏࢖͍ํ͕Φεε ϝɻʢ҆Ձ͚ͩͲIngested Logsͷ՝ۚ͸ൃੜ͢ ΔͷͰ஫ҙʣ
  13. @rwle1212 42 Archives • Datadogͷϩά͸ܖ໿ظؒʢ7೔ͱ͔15೔ͱ ͔ʣ͔͠ݟΕͳ͍ • աڈϩά΋௕ظؒอଘ͍ͨ͠৔߹͸ArchivesͰ S3΍GCSʹஷΊΔ͜ͱ͕Ͱ͖ΔͷͰɺAthena ΍BigQueryͰݟΔ͜ͱ΋Ͱ͖Δ

    • Fluentdͱ͔ͰS3ʹૹΔ͜ͱ΋Ͱ͖Δ͚Ͳɺ Datadogͷ৔߹͸ͱΓ͋͑ͣऩू͢ΔઃఆϑΝ ΠϧΛૹ৴͢Δ͚ͩͰྑ͍ͷͰɺઃఆϑΝΠϧ ͷ͹Β·͖΍ߋ৽͕ͳ͍෼ָ
  14. @rwle1212 47 LogsઃఆͷϕετϓϥΫςΟε • ͱΓ͋͑ͣ • શ෦ͷϩάΛ1Օॴʹू໿͢Δɻѹ౗తޮ཰্͕Δ • Pipeline •

    ύʔεͰ͖Δ͚ͲɺͰ͖ΔݶΓJSONͰૹ৴ͯࣗ͠ಈతʹύʔεͯ͠΋Β͏ • εςʔλεͱ͔͸Ϛοϐϯάͯ͠ɺϏϡʔϫʔͷ੨ɾԫɾ੺৭දࣔͰҰ໨ྎવʹ͢Δ • Indexes • ίετ࡟ݮ͢ΔͨΊʹݟͳ͍ϩά͸আ֎͢Δ • Archives • ೦ͷͨΊաڈϩά͸S3/GCSʹอଘ͢Δ • S3/GCSଆͰҰఆظؒޙʹࣗಈ࡟আ͢ΔΑ͏ʹϥΠϑαΠΫϧΛೖΕΔ