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

Digdagへ日次バッチを移行して幸せになるお話

 Digdagへ日次バッチを移行して幸せになるお話

DMM.comラボではビッグデータ基盤の日次バッチ(ETL処理)のワークフローエンジンとしてDigdagを採用しました。
ワークフローの運用は、障害時のリカバリ、進捗状況に応じた他システム連携、JOB実行時間の局所化など様々な課題があります。
Digdag選定理由や設計の勘所(サーバ構成・ワークフローの設計方針)、Digdag Plugin実装、他チーム連携のためのClient実装など、課題解決のために取り組んだ内容について紹介させていただきました!

DMM.com

June 08, 2017
Tweet

More Decks by DMM.com

Other Decks in Technology

Transcript

  1. 2 Copyright © since 1998 DMM All Rights Reserved. ࣗݾ঺հ

    ೥ʹ%..DPN-BCPʹ৽ଔೖࣾ /PEFKTͰ಺੡#*πʔϧ։ൃ 1SFTUPಋೖ )BEPPQΫϥελӡ༻ ೔࣍όονҠߦΠϚίί ླ໦ᠳଠ !J@T[ZO  %..DPN-BCPγεςϜຊ෦Ϗοάσʔλ෦%3&νʔϜ
  2. 4 Copyright © since 1998 DMM All Rights Reserved. αʔϏεʹ͍ͭͯ

    %..DPN͸೥͔Βଓ͘࿝ฮ αʔϏεαΠτͰ͢ɻ࣌୅ͷχʔζ ʹ߹Θͤͨଟ࠼ͳίϯςϯπΛɺ ೥ؒഓͬͨಠࣗϓϥοτϑΥʔϜͰ ҆ఆతʹఏڙ͍ͯ͠·͢ɻ "CPVU%..DPN Ҏ্ͷ෯޿͍αʔϏεΛల։
  3. 6 Copyright © since 1998 DMM All Rights Reserved. Ϗοάσʔλ෦ͷϛογϣϯ

    ϏοάσʔλΛ༻͍ͯࣄۀͷ,1*ʢॏཁܦӦࢦඪʣ޲্΁ߩݙ͢Δ͜ͱ σʔλυϦϒϯϚʔέςΟϯά ϚʔέςΟϯάΦʔτϝʔγϣϯ ࢪࡦͷޮՌͳͲࠓޙͷܭըΛ ࿅ΔͨΊͷ৘ใΛఏڙ Ϩίϝϯυ΍ݕࡧΤϯδϯͳͲΛ௨ͯ͠ Ϣʔβʔʹద੾ͳ৘ใΛఏڙ
  4. 7 Copyright © since 1998 DMM All Rights Reserved. Ϗοάσʔλ෦ͷ͓࢓ࣄ

    )BEPPQج൫ӡ༻ࢲͷ୲౰ Ϩίϝϯυ ݕࡧ σʔλ෼ੳ ϝϧϚΨ ΞϑΟϦΤΠτ
  5. 8 Copyright © since 1998 DMM All Rights Reserved. ΞδΣϯμ

    ͳͥ%JHEBHͳͷ͔ʁ γεςϜߏ੒ 8PSLqPXઃܭ ϓϥάΠϯͷ࿩ νʔϜؒ࿈ܞ ϋϚΓͲ͜Ζ ·ͱΊ
  6. 9 Copyright © since 1998 DMM All Rights Reserved. ͳͥ%JHEBHͳͷ͔ʁ

    ೔࣍όονͷ՝୊ͱ%JHEBHͷબఆʹࢸΔ·Ͱ
  7. 10 Copyright © since 1998 DMM All Rights Reserved. ଞࣄۀ෦ͷσʔλऔΓࠐΈॲཧ

    σʔλՃ޻ॲཧ #*Ϩϙʔτ޲͚σʔλूܭॲཧ ूܭσʔλͷసૹॲཧ νʔϜ಺ʹ͓͚Δ೔࣍όον
  8. 11 Copyright © since 1998 DMM All Rights Reserved. ଞࣄۀ෦ͷσʔλऔΓࠐΈॲཧ

    &YUSBDU  σʔλՃ޻ॲཧ 5SBOTGPSN  #*Ϩϙʔτ޲͚σʔλूܭॲཧ 5SBOTGPSN  ूܭσʔλͷసૹॲཧ -PBE νʔϜ಺ʹ͓͚Δ೔࣍όον
  9. 12 Copyright © since 1998 DMM All Rights Reserved. ͍ΘΏΔ&5-

    νʔϜ಺ʹ͓͚Δ೔࣍όον σʔλऩूπʔϧͰ࣮ߦ  1ZUIPO੡ Ճ޻ͨ͠σʔλΛ )JWF.BSJB%#ʹసૹ )JWFΫΤϦͰ σʔλՃ޻ &YUSBDU σʔλऔಘॲཧ ˞TRPPQNZTRM 5SBOTGPSN औಘσʔλՃ޻ॲཧ -PBE %8)%BUB.BSU΁ σʔλసૹ
  10. 13 Copyright © since 1998 DMM All Rights Reserved. ͜Ε·Ͱͷόονॲཧ͸ʜ

    #VJME'MPX1MVHJO1BSBNFUFSJ[FE5SJHHFS1MVHJOΛۦ࢖͠ɺ ґଘؔ܎΍ॲཧΛఆٛ νʔϜ಺ʹ͓͚Δ೔࣍όον ˞Wܥ
  11. 16 Copyright © since 1998 DMM All Rights Reserved. +FOLJOTґଘ

    ॲཧϑϩʔ͕ίʔυͰ؅ཧͰ͖͍ͯͳ͍ όονࣦഊ࣌ͷϦτϥΠ͕େม ॲཧ͕࣌ؒґଘ ֤σʔλιʔεͷґଘؔ܎ͷೝ͕ࣝ೉͍͠ ೔࣍όονʹ͓͚Δ՝୊
  12. 17 Copyright © since 1998 DMM All Rights Reserved. ͜ΕΒͷ՝୊Λղܾ͢ΔͨΊɺ+FOLJOT͔Βͷ୤٫Λܾҙ

    ໨త͸ʜ ೔࣍όονॲཧΛ৽ϫʔΫϑϩʔΤϯδϯ΁ϦϓϨΠε ೔࣍όονʹ͓͚Δ՝୊
  13. 19 Copyright © since 1998 DMM All Rights Reserved. ཁ݅͸ओʹͭ

    Մ༻ੑ εέʔϥϏϦςΟ ෼ࢄ࣮ߦฒྻॲཧ  ॲཧϑϩʔ͕ίʔυͰ؅ཧͰ͖Δ ࣦഊͨ͠λεΫ͔ΒϦτϥΠՄೳ ਐḿ֬ೝ͕Ͱ͖ΔΠϯλʔϑΣʔε 3&45"1* ϫʔΫϑϩʔΤϯδϯͷબఆϙΠϯτ
  14. 21 Copyright © since 1998 DMM All Rights Reserved. Մ༻ੑ‎"""

    εέʔϥϏϦςΟ ෼ࢄ࣮ߦฒྻॲཧ ‎""" ॲཧϑϩʔ͕ίʔυͰ؅ཧͰ͖Δ‎" ࣦഊͨ͠λεΫ͔ΒϦτϥΠՄೳ‎" ਐḿ֬ೝ͕Ͱ͖ΔΠϯλʔϑΣʔε 3&45"1* ‎" ϫʔΫϑϩʔΤϯδϯͷબఆϙΠϯτ
  15. 22 Copyright © since 1998 DMM All Rights Reserved. γεςϜߏ੒

    %JHEBHͱͦΕΛऔΓר͘γεςϜ શͯΦϯϓϨͰ͢
  16. 23 Copyright © since 1998 DMM All Rights Reserved. ࠾༻͍ͯ͠Δϛυϧ΢ΣΞ

    %JHEBH   1PTUHSF42-   1HQPPM**   ˞࣌఺
  17. 24 Copyright © since 1998 DMM All Rights Reserved. Streaming

    Replication Watchdog Digdag Server (兼 Client) PostgreSQL (Primary) pgpool-II (Active) VIP PostgreSQL (Standby) pgpool-II (Standby) Digdag Server (兼 Client) Lsyncd & rync
  18. 25 Copyright © since 1998 DMM All Rights Reserved. Streaming

    Replication Watchdog Digdag Server (兼 Client) PostgreSQL (Primary) pgpool-II (Active) VIP PostgreSQL (Standby) pgpool-II (Standby) Digdag Server (兼 Client) Lsyncd & rync
  19. 26 Copyright © since 1998 DMM All Rights Reserved. γεςϜߏ੒%JHEBH

    αʔό݉ΫϥΠΞϯτͷ୆ߏ੒ )"ͷͨΊ  TVQFSWJTPSͰσʔϞϯԽ λεΫ͸෼ࢄ࣮ͯ͠ߦͯ͘͠ΕΔ ࣮ߦϩά΋෼ࢄͯ͠͠·͏ -TZODE STZODͰλεΫϩάΛ૒ํ޲ಉظ
  20. 27 Copyright © since 1998 DMM All Rights Reserved. Watchdog

    Digdag Server (兼 Client) PostgreSQL (Primary) pgpool-II (Active) VIP PostgreSQL (Standby) pgpool-II (Standby) Digdag Server (兼 Client) Lsyncd & rync Streaming Replication
  21. 28 Copyright © since 1998 DMM All Rights Reserved. γεςϜߏ੒1PTUHSF42-

    %JHEBHΛෳ਺୆ͷαʔόΫϥΠΞϯτߏ੒ʹ͢ΔͨΊ ϫʔΫϑϩʔͷ࣮ମ؅ཧ΍λεΫͷεςʔτ؅ཧ 1SJNBSZ4UBOECZͰ୆ߏ੒ 4USFBNJOH3FQMJDBUJPO
  22. 29 Copyright © since 1998 DMM All Rights Reserved. Streaming

    Replication Digdag Server (兼 Client) PostgreSQL (Primary) pgpool-II (Active) VIP PostgreSQL (Standby) pgpool-II (Standby) Digdag Server (兼 Client) Lsyncd & rync Watchdog
  23. 30 Copyright © since 1998 DMM All Rights Reserved. γεςϜߏ੒1HQPPM**

    ໨త͸ෛՙ෼ࢄͰ͸ͳ͘1PTUHSF42-ͷ৑௕Խ 1HQPPM**΋৑௕Խ͢ΔͨΊ୆ߏ੒ "DUJWF4UBOECZ  ͨͩ͠1PTUHSF42-ͱಉډ 8BUDIEPHػೳͰ7JSUVBM*1Λ੍ޚ
  24. 31 Copyright © since 1998 DMM All Rights Reserved. 8PSLqPXઃܭ

    ద੾ͳཻ౓Ͱ֤ϑϩʔͷݟ௨͠Λվળ
  25. 32 Copyright © since 1998 DMM All Rights Reserved. 8PSLqPXઃܭ

    ࣄۀ୯ҐͰͭͷϫʔΫϑϩʔΛ࡞੒͢ΔΑ͏ʹ੔ཧ ྫΦϯϥΠϯήʔϜӳձ࿩ʜFUD ֤ϫʔΫϑϩʔͰ&5-Λߦ͏Α͏ʹ
  26. 33 Copyright © since 1998 DMM All Rights Reserved. &5-ॲཧͷΠϝʔδ

    &YUSBDU 5SBOTGPSN -PBE &YUSBDU 5SBOTGPSN -PBE &YUSBDU 5SBOTGPSN -PBE ήʔϜࣄۀ෦ ϫʔΫϑϩʔ ˚˚ࣄۀ෦ ϫʔΫϑϩʔ ˘˘ࣄۀ෦ ϫʔΫϑϩʔ
  27. 34 Copyright © since 1998 DMM All Rights Reserved. &5-ॲཧͷΠϝʔδ

    &YUSBDU 5SBOTGPSN -PBE &YUSBDU 5SBOTGPSN -PBE &YUSBDU 5SBOTGPSN -PBE ήʔϜࣄۀ෦ ϫʔΫϑϩʔ ˚˚ࣄۀ෦ ϫʔΫϑϩʔ ˘˘ࣄۀ෦ ϫʔΫϑϩʔ
  28. 35 Copyright © since 1998 DMM All Rights Reserved. 8PSLqPXઃܭ

    ήʔϜࣄۀ෦ͷ৔߹ 4MBDL௨஌ςϯϓϨʔτ HBNFࣄۀ෦ϫʔΫϑϩʔ &5-ΛDBMM͢Δ ύϥϝʔλ HBNFࣄۀ෦ͷ࣮ॲཧ HBNFEJH͔ΒDBMM͞ΕΔ
  29. 36 Copyright © since 1998 DMM All Rights Reserved. 8PSLqPXઃܭ

    ήʔϜࣄۀ෦ͷ৔߹ ڞ௨ύϥϝʔλಡΈࠐΈ HBNFEJH Τϥʔ࣌ͷ௨஌ HBNFࣄۀ෦ͷॲཧΛDBMM ˞FYUSBDUΛݺΜͰ͍Δ εέδϡʔϧઃఆ 4-"࣌ͷ௨஌
  30. 37 Copyright © since 1998 DMM All Rights Reserved. 8PSLqPXઃܭ

    ࣄۀ୯ҐͰ੔ཧͨ͜͠ͱͰશମͷݟ௨͕͠վળ ϧʔϧΛܾΊͨ͜ͱͰ୭͕ݟͯ΋Θ͔ΔΑ͏ʹ :BNMܗࣜͳͷͰಡΈ΍͍͢ Կ͔վम͕ೖΔ࣌ɺखೖΕ͠΍͍͢
  31. 39 Copyright © since 1998 DMM All Rights Reserved. %JHEBHͰ͸ओʹ3VCZ4IFMM4DSJQUΛར༻

    Α͘࢖͏ΦϖϨʔλʔ SC3VCZͷλεΫΛ࣮ߦ TI4IFMM4DSJQUΛ࣮ߦ σʔλऩूπʔϧͷ࣮ߦ TMBDL4MBDL΁ͷ௨஌ ˞ޙड़ 8PSLqPXઃܭ
  32. 41 Copyright © since 1998 DMM All Rights Reserved. ϓϥάΠϯΛࣗ࡞ͨ͠ࣄྫ

    4MBDL௨஌Λ࣮ݱ͢ΔEJHEBHTMBDLΛ࡞ͬͨ TMBDLΦϖϨʔλʔ͕࢖͑ΔΑ͏ʹ :BNMܗࣜͷςϯϓϨʔτ͔Β4MBDL௨஌ ม਺ͷຒΊࠐΈ΋Մೳ
  33. 42 Copyright © since 1998 DMM All Rights Reserved. 4MBDL΁ͷ௨஌ͷྫ

    ݺͼग़͢UFNQMBUFTTVDDFTTZNMΛ࡞੒ TMBDLEJHΛ࡞੒
  34. 44 Copyright © since 1998 DMM All Rights Reserved. 4MBDL΁ͷ௨஌

    ϓϥάΠϯͷαϯϓϧ Τϥʔ࣌ 4-"ʢࢦఆܦա࣌ؒ಺ʹ׬ྃ͠ͳ͍࣌ʣ
  35. 45 Copyright © since 1998 DMM All Rights Reserved. ϓϥάΠϯ

    ͳͥ࡞͔ͬͨʁ Ϧονͳ௨஌͕͔ͨͬͨ͠ λεΫ੒ޭ࣌Τϥʔ࣌4-"ͷ௨஌ʹར༻ ࢼ͠ʹ࡞ͬͯΈͨΒαΫοͱͰ͖ͨʢ+BWBʣ NZVJEJHEBHQMVHJOFYBNQMFΛࢀߟʹ࣮૷ +JUQBDLʹެ։͢Ε͹ར༻΋ָʑ
  36. 46 Copyright © since 1998 DMM All Rights Reserved. ϓϥάΠϯ

    (JUIVCʹͯެ։த (JUIVCɿIUUQTHJUIVCDPNT[ZOEJHEBHTMBDL ϒϩάɿIUUQJSPJMPHOFUEJHEBHTMBDLɹ
  37. 49 Copyright © since 1998 DMM All Rights Reserved. νʔϜؒ࿈ܞ

    &5-ॲཧ͕ऴΘΔ·Ͱ ଴ػ 4VDFTT ΋͠΋ɺ໨తͷλεΫ͕ ੒ޭʹͳͬͨΒ ޙଓॲཧελʔτ 1PMMJOH 4UBSU ࣌ؒʹґଘ͠ͳ͍ͨΊͷϑϩʔΛߟ͑ͨ ̋̋ϓϩδΣΫτͷ˚˚ϫʔΫϑϩʔͷ˘˘ͱ͍͏ λεΫ͕ऴΘ͍ͬͯͨΒɺδϣϒΛ࣮ߦ͍ͨ͠ʂ
  38. 50 Copyright © since 1998 DMM All Rights Reserved. νʔϜؒ࿈ܞ

    (PݴޠͰ$-*πʔϧ NPH Λ࡞੒͠ఏڙ NPHͰ͸ಛఆͷϓϩδΣΫτͷϫʔΫϑϩʔΛɺ λεΫ໊ϕʔεͰεςʔλε֬ೝ͕Մೳʹ ϫʔΫϑϩʔΛελʔτϦτϥΠ͢Δػೳ΋
  39. 51 Copyright © since 1998 DMM All Rights Reserved. NPHͷ঺հ

    ࢖༻ྫ NPHͰ͸λεΫͷεςʔλεऔಘ ϫʔΫϑϩʔͷελʔτ ϦτϥΠػೳΛఏڙ
  40. 52 Copyright © since 1998 DMM All Rights Reserved. NPHͷ঺հ

    ࢖༻ྫ TBNQMFϓϩδΣΫτ TMBDLϫʔΫϑϩʔ TMBDL TUFQλεΫεςʔλεऔಘͷྫ
  41. 53 Copyright © since 1998 DMM All Rights Reserved. NPHͷ঺հ

    ࢖༻ྫ λεΫͷελʔτϦτϥΠ΋Մೳ ҎԼ͸ϫʔΫϑϩʔͷελʔτྫ
  42. 56 Copyright © since 1998 DMM All Rights Reserved. %JHEBH4FSWFSͰࣗ࡞ϓϥάΠϯ͕࢖͑ͳ͍

    ‎ݱঢ়͸%JHEBH4FSWFSΛىಈͨ͠ΧϨϯτσΟϨΫτϦʹ ϓϥάΠϯΛμ΢ϯϩʔυ͢Δ࢓༷ σΟϨΫτϦݖݶͷݟ௚͠ͰରԠ ϋϚΓͲ͜Ζ
  43. 57 Copyright © since 1998 DMM All Rights Reserved. λεΫ͕Ұ޲ʹਐ·ͳ͍ɾҟৗʹ͕͔͔࣌ؒΔ

    ‎1HQPPM**Ͱ-PBECBMBODFNPEFΛ༗ޮʹ͍ͯͨ͠ ‎%JHEBHͷ%BUBCBTF઀ଓ͕4PDLFU5JNFPVU 1HQPPM**ͷMPBE@CBMBODF@NPEFΛGBMTFʹ ෳ਺୆ߏ੒Ͱ௕࣌ؒͷόονΛ࣮ߦ͢Δࡍʹ͸ɺ EBUBCBTFTPDLFU5JNFPVU EFGBVMU ʹ஫ҙ ϋϚΓͲ͜Ζ
  44. 59 Copyright © since 1998 DMM All Rights Reserved. ͜ͷΑ͏ͳ՝୊͕͋Γ·ͨ͠

    +FOLJOTґଘ ॲཧϑϩʔ͕ίʔυͰ؅ཧͰ͖͍ͯͳ͍ ֤σʔλιʔεͷґଘؔ܎ͷೝ͕ࣝ೉͍͠ όονࣦഊ࣌ͷϦτϥΠ͕େม ॲཧ͕࣌ؒґଘ ·ͱΊ
  45. 60 Copyright © since 1998 DMM All Rights Reserved. +FOLJOTґଘ

    +FOLJOT͔Βͷ୤٫ʹ੒ޭ ॲཧϑϩʔ͕ίʔυͰ؅ཧͰ͖͍ͯͳ͍ શͯίʔυͰ؅ཧՄೳʹ ֤σʔλιʔεͷґଘؔ܎ͷೝ͕ࣝ೉͍͠ ίʔυͰґଘؔ܎΋දݱ όονࣦഊ࣌ͷϦτϥΠ͕େม όονࣦഊ࣌ͷϦτϥΠ΋ָͪΜʹ ॲཧ͕࣌ؒґଘ NPH$-*ͷఏڙʹΑΓ࣌ؒґଘͷॲཧΛഉআ ·ͱΊ
  46. 61 Copyright © since 1998 DMM All Rights Reserved. ߋʹخ͔ͬͨ͠ͱ͜Ζʜ

    ฒྻॲཧͰόονॲཧ͕ߴ଎ʹ ݸʑͷλεΫʹԿ෼͔͔Δͷ͔ࢹ֮తʹ೺ѲՄೳʹ ·ͱΊ