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

簡略化したネットワーク依存関係グラフの可視化基盤 / Simplified network dependency graph visualization

簡略化したネットワーク依存関係グラフの可視化基盤 / Simplified network dependency graph visualization

第3回Web System Architecture研究会@東京

Yuuki Tsubouchi (yuuk1)

November 17, 2018
Tweet

More Decks by Yuuki Tsubouchi (yuuk1)

Other Decks in Research

Transcript

  1. ؆ུԽͨ͠
    ωοτϫʔΫґଘؔ܎άϥϑ
    ͷՄࢹԽج൫
    id:y_uuki, id:masayoshi, ͸ͯͳ
    2018/11/17 ୈ3ճ Web System Architectureݚڀձ@౦ژ

    View full-size slide

  2. ໨࣍
    1. എܠͱ໨త
    2. ఏҊख๏
    3. ·ͱΊ

    View full-size slide

  3. 1. എܠͱ໨త

    View full-size slide

  4. എܠ
    • ωοτϫʔΫґଘؔ܎ͷෳࡶԽ
    • 10೥୯ҐͷαʔϏεͷ௕ظӡ༻ͷؒʹ౓ॏͳΔ૿ங
    • ϚΠΫϩαʔϏεͳͲͷۙ೥ͷτϨϯυมԽ
    • γεςϜ؅ཧऀ͕هԱͰ͖ͳ͍ݸʑͷ௨৴ͷґଘؔ܎
    • Өڹൣғ͕Θ͔Βͳ͍ͨΊɺมߋͷͨͼʹґଘؔ܎Λ
    ௐࠪ͢Δඞཁ͕ൃੜ

    View full-size slide

  5. ઌߦख๏
    • ϑΝΠΞ΢ΥʔϧͷϩΪϯάػߏ΍ύέοτΩϟϓνϟ
    • TCP/UDP௨৴ϩάΛूܭαʔόʹసૹ͠ґଘՄࢹԽ
    • ωοτϫʔΫεΠον͔Βͷ౷ܭ৘ใऔಘ (sFlow/NetFlowͳͲ)
    • αΠυΧʔϓϩΩγ΍ΞϓϦέʔγϣϯϩά (෼ࢄτϨʔγϯά)

    View full-size slide

  6. ֤ઌߦख๏ͷ՝୊
    • ϑΝΠΞ΢ΥʔϧϩΪϯά(iptables)
    • a) ύέοτϨΠςϯγ͕૿Ճ
    • ύέοτΩϟϓνϟ(tcpdump)
    • b) ύέοτશମΛऩू͢ΔͨΊɺऩू·ͨ͸ղੳͷͨΊͷෛՙͷ૿Ճ
    • sFlow/NetFlow
    • c) αϯϓϦϯά͞ΕΔͨΊґଘ໢ཏ཰͕௿Լ
    • ΞϓϦέʔγϣϯ૚(L7)ͰͷϦΫΤετ୯ҐͷϩΪϯά
    • d) ΞϓϦέʔγϣϯͷมߋ͕ඞཁ

    View full-size slide

  7. ઌߦख๏શମͷ՝୊
    • e) ऩूσʔλ͕ґଘؔ܎Λ஌Δ͚ͩʹͯ͠͸਺͕ଟ͘৑௕
    • ύέοτɺTCP઀ଓɺϦΫΤετ୯Ґͷ৘ใ
    • ྫ͑͹ΤϑΣϝϥϧϙʔτͷ઀ଓ৘ใͳͲ
    • f) ґଘؔ܎άϥϑߏ଄ͷෳࡶԽ
    • ෛՙ෼ࢄͳͲʹΑΓϗετ਺͕૿Ճͨ͠৔߹ʹϊʔυͱΤο
    δͷݸ਺͕૿͑Δ

    View full-size slide

  8. 2. ఏҊख๏

    View full-size slide

  9. ཁ݅
    • 1)ΞϓϦέʔγϣϯੑೳʹӨڹΛ༩͑ͳ͍઀ଓ৘ใͷऩूՄೳ (՝୊
    a),b),c))
    • ݱ࣮తͳਫ਼౓Ͱ઀ଓ৘ใͷऩू΋ཱ྆
    • 2)ΞϓϦέʔγϣϯͷมߋෆཁͰऩूՄೳ (՝୊d)
    • 3)ू໿Խ͞Εͨϊʔυ୯ҐͰՄࢹԽՄೳ (՝୊e)
    • 4)ϗετ୯ҐͰ͸ͳ͘ϗετͷෳ੡άϧʔϓ୯ҐͰՄࢹԽՄೳ ՝୊ f)
    • 5)೚ҙͷ࣌ؒൣғͰͷґଘؔ܎Λग़ྗՄೳ

    View full-size slide

  10. ఏҊख๏
    • ΞϓϦέʔγϣϯͷมߋෆཁͳωοτϫʔΫ௨৴৘ใͷऩू (ཁ݅2)
    • OSʹ໰͍߹ΘͤऔಘՄೳͳTCP઀ଓ৘ใΛར༻
    • ΞϓϦέʔγϣϯੑೳʹӨڹΛ༩͑ͳ͍TCP઀ଓ৘ใͷऩू (ཁ݅1)
    • OS͕΋ͭ௿ෛՙͰऔಘՄೳͳTCP઀ଓͷ౷ܭ৘ใΛར༻
    • ू໿Խ͞ΕͨΤοδͱϊʔυ୯ҐͰՄࢹԽՄೳ
    • Τοδ: ಉҰϗετ͔ͭಉҰϦοεϯϙʔτ΁ͷTCP઀ଓू໿ (ཁ݅3)
    • ϊʔυ: αʔό؅ཧπʔϧͷAPIͱ࿈ܞՄೳ (ཁ݅4)
    • ίωΫγϣϯ؅ཧDBʹू໿Խ͞ΕͨTCP઀ଓΛ࣌ؒ෇͖Ͱ؅ཧՄೳ (ཁ݅5)

    View full-size slide

  11. ϗετϑϩʔू໿
    • Τοδ: ಉҰϗετ͔ͭಉҰϦοεϯϙʔτ΁ͷTCP઀ଓू໿
    • Τοδͷ໼ҹͷ޲͖: TCPͷΞΫςΟϒΦʔϓϯͱύογϒΦʔϓϯͰ൑ఆ
    port 80
    port 3306
    port 10000
    port 10001
    port 10002
    port 15000
    port 15001
    port 15002
    ϗετϑϩʔ
    ϗετϑϩʔ
    Host Host

    View full-size slide

  12. ϗετϑϩʔू໿ͷ࣮૷
    • 1. Netlink APIʹΑΓTCP઀ଓ৘ใΛऔಘ͢Δ
    • 2. LISTENεςʔτͷ઀ଓͷϩʔΧϧϙʔτͷΈநग़
    • 3. 1.ͱ2.Λಥ͖߹Θͤɼ઀ଓઌϙʔτ͕ϦοεϯϙʔτͰ͋Ε
    ͹ΞΫςΟϒΦʔϓϯɼͦΕҎ֎ͷ઀ଓ͸ύογϒΦʔϓϯͱ
    ൑ఆ͢Δɽ

    View full-size slide

  13. send
    agent
    agent
    CMDB
    Host
    Host
    agent
    Host
    analyzer
    sysadmin
    get
    get
    ఏҊख๏ͷશମϑϩʔ֓ཁ

    View full-size slide

  14. send
    agent
    agent
    Postgres
    Host
    Host
    agent
    Host
    CLI
    sysadmin
    get
    get
    ఏҊख๏ͷશମϑϩʔ֓ཁ
    Mackerel
    get

    View full-size slide

  15. CMDBͷεΩʔϚ
    • nodesςʔϒϧ: ϊʔυ৘ใ
    • IDͱIPΞυϨεͱϙʔτ൪߸
    • flowsςʔϒϧ: ϗετϑϩʔ৘ใ
    • IDͱ޲͖ͱૹ৴ݩͱૹ৴ઌͷͦΕͧΕͷϊʔυID

    View full-size slide

  16. Mackerel APIʹΑΔෳ੡ϊʔυͷάϧʔϓԽ
    • ͋Β͔͡Ί֤ϗετΛMackerelʹొ࿥͠ɺෳ੡͞Εͨϗετ܈Λ1
    ͭͷϩʔϧʹ·ͱΊ͓ͯ͘
    • MackerelΛར༻ͨ͠ෳ੡ϊʔυͷάϧʔϓԽखॱ
    • analyzer͕CMDB͔ΒϊʔυΛऔಘ
    • Mackerel APIʹΑΓϗετ৘ใҰཡΛऔಘ͠౰֘ϊʔυͷIPΞυ
    ϨεͰϑΟϧλ
    • ಉҰϩʔϧ಺ͷϊʔυΛάϧʔϓԽ

    View full-size slide

  17. github.com/yuuki/mftracer
    $ mftctl --level 2 --dest-service blog --dest-roles redis --dest-roles memcached
    blog:redis
    ᵋ<-- 10.0.0.22:many (connections:30)
    ᵋ<-- 10.0.0.23:many (connections:30)
    ᵋ<-- 10.0.0.24:many (connections:30)
    ᵋ<-- 10.0.0.30:many (connections:1)
    ᵋ<-- 10.0.0.31:many (connections:1)
    ᵋ<-- 10.0.0.25:many (connections:30)
    blog:memcached
    ᵋ<-- 10.0.0.23:many (connections:30)
    ᵋ<-- 10.0.0.25:many (connections:30)

    View full-size slide

  18. ࣮૷্ͷ՝୊
    • ωοτϫʔΫτϙϩδͷ॥؀ʹର͢Δߟྀ
    • Ϋϥ΢υࣄۀऀ͕ఏڙ͢ΔϚωʔδυαʔϏεΛར༻͍ͯ͠Δ
    ৔߹ɼIPΞυϨε͔Β࣮ମΛͨͲΔ͜ͱͷࠔ೉
    • ͋ΔಛఆͷϊʔυΛࢦఆ͠ɼࢦఆͨ͠ϊʔυ”͔Β”઀ଓ͢Δ
    ϊʔυҰཡΛऔಘ͢Δ࣮૷ (ٯ͸Մೳ)
    • ࣌ؒൣғΛࢦఆͨ͠ґଘؔ܎ͷऔಘ
    • ݱࡏ͔Βաڈ͢΂ͯͷґଘؔ܎Λऔಘ͢ΔΑ͏ʹͳ͍ͬͯΔ

    View full-size slide

  19. ·ͱΊ
    • γεςϜ؅ཧऀ͕ݸʑͷωοτϫʔΫґଘؔ܎ΛهԱͰ͖ͳ͍
    • ΞϓϦέʔγϣϯΛมߋͤͣʹɼΞϓϦέʔγϣϯʹӨڹΛ༩
    ͑Δ͜ͱͳ͘ɼద੾ͳந৅౓Ͱ৘ใΛऔಘՄೳͳґଘؔ܎ղੳ
    γεςϜ

    View full-size slide

  20. ࠓޙͷ՝୊
    • αʔϕΠ
    • ֤ωοτϫʔΫ૚Ͱઌߦݚڀ͕͋ΔͨΊɺຊݚڀͷཱͪҐஔΛ໌֬Խ
    • ධՁ
    • ϑΝΠΞ΢ΥʔϧϩΪϯάͱύέοτΩϟϓνϟͷϨΠςϯγ૿େͷධՁ
    • ͢΂ͯͷ઀ଓ৘ใΛऔಘͰ͖ΔΘ͚Ͱ͸ͳ͍ͨΊɼ઀ଓ৘ใͷऔಘ཰Λ֬
    ೝ͠ɼ࣮ӡ༻ʹ͓͍ͯɼे෼ͳਫ਼౓Ͱ͋Δ͜ͱΛ֬ೝ
    • ల๬
    • ಉ͡Α͏ͳ௨৴Λ͍ͯ͠ΔϗετΛΫϥελϦϯάਪఆ
    • ίϯςφܕԾ૝Խ؀ڥͰͷґଘؔ܎ͷղੳ΁ͷൃల

    View full-size slide