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

小宇宙は燃えているか?

 小宇宙は燃えているか?

JAZUG #7 LT の資料

8db3c91c8b3d3e5686f62fbf43c303dd?s=128

Tatsuya Sato

July 25, 2017
Tweet

Transcript

  1. খӉ஦͸೩͍͑ͯΔ͔ʁ - Azure Cosmos DBΛյͪ͠Όͬͨ - JAZUG Night, 25h Jul

    2017 Tatsuya Sato Rakuten, Inc.
  2. 2 ࠤ౻ཽ໵ ৽نαʔϏε։ൃ෦ Ruby, Agile, Azure

  3. ઌ೔ɺͱ͋ΔΤϰΝʹ঺հ͞Εͨهࣄ͕όζΓ·ͨ͠ɻ 3 ϝιου԰ͷϒϩά http://simplearchitect.hatenablog.com/entry/2017/06/19/080036

  4. Ϟϒϓϩάϥϛϯάͯ͠·͢ɻ 4 ίί

  5. ࠓ೔ͷ͓࿩ • Azure Cosmos DBΛۀ຿Ͱ࢖ͬͯΈͨΒɺյ ͪ͠Όͬͨɻ • ΍ͬͨ͜ͱɺࠔͬͨʢͯΔʣ͜ͱͷ࿩ • Cosmos

    DBͷ࢖͍ํͷ࿩͸͠·ͤΜɻ • υΩϡϝϯτΛಡΜͰɺ࢖ͬͯΈͯ͘ ͍ͩ͞ɻ 5
  6. ͬ͘͟Γͱ͓࢓ࣄʹ͍ͭͯ • ৽نࣄۀ։ൃ • ·ͩPoCͷஈ֊ • σϞˠϑΟʔυόοΫˠमਖ਼ˠσϞ ͷαΠ ΫϧΛૣ͘ճ͍ͨ࣌͠ظ 6

  7. WHY DO WE CHOOSE COSMOS DBʁ ͳͥCosmos DBΛબΜͩͷ͔ 7

  8. બ୒ࢶ • Azure SQL Database • Azure Database for MySQL

    • Azure Cosmos DB 8
  9. Azure SQL Database • ։ൃ؀ڥߏங͕େมͦ͏ • ϝϯόʔͷ؀ڥ͕MacɺWinࠞࡏ • ϝϯόʔͷ୭΋ར༻ܦݧͳ͠ •

    Ͱ΋ɺ͙͢ʹϓϩμΫτ։ൃʹணख͍ͨ͠… 9
  10. Azure Database for MySQL • MySQLɺ·͡MySQL • ͜Ε·Ͱͷܦݧ͕׆͔ͤͦ͏ʂ • ͔͠͠ɺPreview൛…

    • ͦ͜Ͱ᪴͘ΑΓ͔͸ɺϓϩμΫτ։ൃʹूத ͍ͨ͠… 10
  11. Azure Cosmos DBͷಛ௃ • ϚϧνσʔλϞσϧ • SQL, Mongo API, Key-Value,

    Graph • Ϧʔδϣϯލ͍ͩϨϓϦέʔγϣϯ • ߴ͍SLA • ಉ͡Ϧʔδϣϯ಺Ͱ͋Ε͹ಡΈࠐΈ10msҎ ಺Λ99%Ͱอূ 11
  12. Azure Cosmos DB • ͨ·ͨ·ϝϯόʔશһʹMongoDBͷར༻ܦݧ ͕͋ͬͨɻ • ϩʔΧϧͰͷ։ൃ؀ڥ΋MongoDBΛΠϯε τʔϧ͢Ε͹OK •

    PHPͷAzure DocumentDB API ͷϥΠϒϥ Ϧ͸͚͋ͬͨͲɺ։ൃ͕ࢭ·ͬͯͨɻ 12
  13. ଞͷAPIͰܨ͙ Document DBλΠϓʹMongo APIͰɺMongoλΠϓʹDocumentDB APIͰܨ͙ 13

  14. େ੾ͳ͜ͱ 14 ଞͷAPIͰͷ઀ଓ৘ใ͸ϙʔλϧ ʹࡌͬͯͳ͍ɻ

  15. େ੾ͳ͜ͱ 15 ଞͷAPIͰͷ઀ଓ৘ใͷऔಘํ๏͸ υΩϡϝϯτʹ΋ʢ͓ͦΒ͘ʣͳ͍ɻ

  16. DocumentDB MongoDB 16

  17. 17 ͔͠͠ޓ׵ੑ͸͋Δɻ

  18. DocumentDBʹMongo APIͰܨ͙࣌ͷURL • mongodb://ΞΧ΢ϯτ໊:ϚελʔΩʔ@ ΞΧ΢ϯτ໊.documents.azure.com: 10255/?ssl=true • Ϣʔβʔ໊͸ɺΞΧ΢ϯτ໊ • ύεϫʔυʹɺϚελʔΩʔ

    • SSLͰͳ͍ͱ઀ଓͰ͖ͳ͍ͷͰ஫ҙ 18
  19. MongoDBʹDocumentDB APIͰܨ͙࣌ͷURL • https://ΞΧ΢ϯτ໊.documents.azure.com:443 • ϚελʔΩʔͱͯ͠ɺMongoDB ͷύε ϫʔυΛͦͷ··࢖͑Δɻ 19

  20. ଞͷAZUREͷαʔϏεͱܨ͛Δ Functions, DataFactory ͳͲDocumentDB APIΛαϙʔτ 20

  21. ࠷ۙग़͖ͯͨཁ݅ • ڠྗձ͔ࣾΒσʔλΛऔΓࠐΈ͍ͨɻ • Treasuredata͔ΒAzure Blob Storageʹ CSVΛग़ྗՄೳ • ͔ͦ͜ΒઌΛͲ͏͠Α͏ʁ

    • Functions? 21
  22. Azure DataFactory • σʔλͷύΠϓϥΠ ϯɺεέδϡʔϦϯά ͷαʔϏε • ୯७ͳσʔλͷΠϯ ϙʔτͳΒJSONͰઃ ఆΛॻ͚ͩ͘ɻ

    22
  23. ͜Μͳײ͡ 23 ΄ͱΜͲίʔυΛॻ͔ͣʹσʔλ࿈ܞΛ࣮ݱʂ

  24. Cosmos DBɺյΕͨ… 24 “Blender Cycles - Armageddon” by NGCHunter2 /

    CC BY-NC-ND
  25. Կ͕ى͖ͨͷ͔ʁ • MongoDBʹDocumentDB APIܦ༝ͰσʔλΛೖΕΔͱյΕ Δɻ • Insert͸Ͱ͖Δ͚ͲɺRead͕Ͱ͖ͳ͘ͳͬͨɻ • Data Factory͸Կ΋໰୊ͳ͘σʔλΛೖΕଓ͚Δ…

    25
  26. Ͳ͏΍Β׬શʹޓ׵Ͱ͸ͳ͍ͬΆ͍ • DocumentDB ʹMongo APIͰσʔλ௥Ճ͸ ʢࠓͷͱ͜Ζʣ໰୊ͳ͍ • DocumentDBΛ࢖͑͹େৎ෉ʁ • ͚Ͳɺσʔλͷ࣋ͪํ΋ҟͳΔɻ

    26
  27. DocumentDB APIͰೖΕͨυΩϡϝϯτͷߏ଄ • API͝ͱͰߏ଄ͷݟ͑ํ͕ҟͳΔɻ 27 DocumentDB API Mongo API

  28. DocumentDBʹMongoAPI͔ΒಡΈॻ͖͢Δ࣌ͷϙΠϯτ • ঢ়گʹΑΓಠࣗʹIDΛ࠾൪͢Δඞཁ͋Γ • DocumentDB ͕෇͚ΔID "_rid" ͸Mongo API͔Β͸࢖͑ͳ͍ɻ •

    ͦͷࡍͷIDͷ໊લ͸ɺDocumentDB͕෇͚Δଐੑ໊ͱҟͳΔ΋ ͷ͕ྑ͍ɻ • ಺෦Ͱ໊લ͕มߋ͞Εͯ͠·͏ɻʢྫɿ _rid -> $_rid ʣ • DocumentDB APIͱMongo APIͰ࢖͏͜ͱΛߟྀͨ͠ํ͕ྑ͍ɻ 28
  29. ·ͱΊ • MongoDB ʹDocumentDB APIͰσʔλΛೖΕΔͱ ʢࠓͷͱ͜Ζʣ2౓ͱ࢖͑·ͤΜɻ • DocumentDB ͳΒMongo APIͰ΋DocumentDB

    API Ͱ΋ಡΈॻ͖OK • DocumentDBͷ৔߹ɺMongoDBͱυΩϡϝϯτͷߏ ଄͕ҟͳΔͷͰσʔλઃܭ࣌ʹ஫ҙ͠·͠ΐ͏ɻ 29