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

Amazon Auroraを活用したソーシャルゲームの複数ワールドデータ統合 / AWS Dev Day Online Japan

Amazon Auroraを活用したソーシャルゲームの複数ワールドデータ統合 / AWS Dev Day Online Japan

FUJIWARA Shunichiro

September 29, 2021
Tweet

More Decks by FUJIWARA Shunichiro

Other Decks in Technology

Transcript

  1. Amazon AuroraΛ׆༻ͨ͠
    ιʔγϟϧήʔϜͷෳ਺ϫʔϧυσʔλ౷߹
    Dev Day Online Japan
    2021-09-29 ౻ݪ ढ़Ұ࿠ (@fujiwara)

    View full-size slide

  2. @fujiwara SREνʔϜ
    github.com/kayac/ecspresso
    Amazon ECS σϓϩΠπʔϧ
    github.com/fujiwara/lambroll
    AWS Lambda σϓϩΠπʔϧ
    ISUCON11
    !
    ༏উ (4ճ໨)

    View full-size slide

  3. Game & Community

    View full-size slide

  4. Agenda
    • ΅͘ΒͷߕࢠԂʂϙέοτ ʹ͍ͭͯ
    • ήʔϜϫʔϧυͷ௥Ճͱ౷߹ͷܦҢ
    • ;ͨͭͷσʔλϕʔεΛͻͱͭʹ
    • Amazon Aurora Λ׆༻ͨ͠ߴ଎ͳ
    σʔλҠߦͱݕূ

    View full-size slide

  5. ΅͘ΒͷʂߕࢠԂϙέοτ ʹ͍ͭͯ

    View full-size slide

  6. ΅͘ΒͷʂߕࢠԂϙέοτ ήʔϜγεςϜ
    2014೥9݄ϦϦʔεͷεϚʔτϑΥϯ޲͚ήʔϜ (7प೥!)
    ϓϨΠϠʔ͸ʮߴߍٿࣇʯʹͳΔ
    ϛχήʔϜͰͷ࿅शɺ૷උΛڧ͘͢ΔͳͲͰྗΛ෇͚͍ͯ͘
    ֶߍʹෳ਺ͷϓϨΠϠʔ͕ू·ͬͯɺ1೔4ճ૊·ΕΔࢼ߹ʹࢀՃ
    ૬ख΋࣮ࡏͷϓϨΠϠʔ͕ू·ͬͯߏ੒͞ΕͨνʔϜ
    ͍ΘΏΔCPUઓ͸ͳ͍
    ࢼ߹͸αʔόʔଆͰόονॲཧʹΑͬͯਐߦͯ݁͠Ռ͕ग़Δ

    View full-size slide

  7. ΅͘ΒͷʂߕࢠԂϙέοτ αʔόʔ؀ڥ
    2014೥9݄ϦϦʔε࣌఺͔Β͢΂ͯ
    Amazon Web Services(AWS)
    Amazon Elastic Compute Cloud (EC2)
    Amazon RDS for MySQL
    Amazon ElastiCache for Redis
    Amazon Redshift
    2016೥10݄ RDS for MySQL → Aurora MySQL
    2021೥3݄ EC2 → Amazon Elastic Container Service(ECS)

    View full-size slide

  8. ήʔϜϫʔϧυͷ௥Ճͱ౷߹ͷܦҢ

    View full-size slide

  9. ҰൠతͳεϚʔτϑΥϯ޲͚ήʔϜͷ
    Ϣʔβʔ਺ਪҠ (֓೦)
    1. ϦϦʔεޙҰఆظؒ·Ͱٸܹʹ૿Ճ
    2. ؇΍͔ʹݮগ
    3. ޿ࠂ΍ίϥϘࢪࡦͰҰ࣌తʹ૿Ճ
    2→3→2→3 Λ܁Γฦ͢
    ଛӹ෼ذ఺ΛԼճΓ
    ҡ࣋Ͱ͖ͳ͘ͳΔͱαʔϏεऴྃ΁
    ͲΕ͚ͩݮগΛ؇΍͔ʹͰ͖Δ͔Ͱ
    ण໋͕มΘͬͯ͘Δ

    View full-size slide

  10. GvG (guild versus guild) ήʔϜͷಛੑ
    ϦϦʔε࣌఺Ͱ͸ͻͱͭͷϫʔϧυ͔͠ͳ͔ͬͨ
    GvG ήʔϜ = ରਓؒ(νʔϜ)ઓ
    ࢒͍ͬͯΔϢʔβʔ͸೥݄ͱͱ΋ʹͲΜͲΜڧ͘ͳ͍ͬͯ͘
    • ৽نϢʔβʔ͕ೖͬͯ΋ͳ͔ͳ͔উͯͳ͍
    • ͔ͤͬ͘ೖ͖ͬͯͯ͘Εͨ৽نϢʔβʔ͕ఆண͠ͳ͍
    ݮগ͕Ճ଎͢ΔͱαʔϏε͕ҡ࣋Ͱ͖ͳ͍
    㱺 ·ͬ͞Βͳ৽نϫʔϧυΛ௥Ճ͠Α͏ʂ
    ৽نϢʔβʔ͕ઓ͑ΔੈքΛ༻ҙͯ͠ɺͦ͜Ͱఆணͯ͠΋Β͏

    View full-size slide

  11. ϫʔϧυ௥Ճͷ࣮ࢪ
    ϦϦʔε͔Β1೥൒ޙɺ2016೥2݄ݕ౼։࢝
    ׬શʹಠཱͨ͠σʔλϕʔεͱΞϓϦέʔγϣϯΛ௥Ճ͢Δ࣮૷
    • Ϛελʔσʔλ(ΞΠςϜͳͲ)͸׬શʹಉҰ
    • ֤ϫʔϧυؒͰϢʔβʔσʔλͷҠߦ͸Ͱ͖ͳ͍
    • ϓϨΠ͢ΔϫʔϧυΛҰ౓બ୒ͨ͠Β
    ผϫʔϧυͰ͸ϓϨΠͰ͖ͳ͍
    • جຊతʹ֤ϫʔϧυͷαʔόʔؒͰ௨৴͸͠ͳ͍
    (ྫ֎: σϓϩΠૢ࡞΍Redshift΁ͷΫΤϦ͸1Χॴ͔Βߦ͑Δ)

    View full-size slide

  12. 2016೥8݄ ৽ϫʔϧυ௥Ճ

    View full-size slide

  13. ͍͔ͭऴΘΔ͜ͱΛߟ͑ͯɺ௥Ճ௚ޙʹ౷߹ʹ͍ͭͯ΋ݕ౼͞Ε͍ͯͨ (͑Β͍)

    View full-size slide

  14. ͦͯ͠2021೥ɺϫʔϧυʮ౷߹ʯ΁
    αʔϏε։͔࢝Β6೥ɺϫʔϧυ௥Ճ͔Β΋4೥͕ܦա
    ϓϩσϡʔαʔஊʮ࣍͸10प೥Λ໨ࢦ͍ͨ͠ʯ
    ήʔϜͷಛੑ্ɺϓϨΠϠʔ͕ଟ͍΄͏͕໘ന͍
    • ΞΫςΟϒͳνʔϜͱରઓͯ͠উͭ΄͏͕໘ന͍
    • ৽Ϣʔβʔ͕ผʑͷϫʔϧυʹ഑ஔ͞ΕΔͱ૿͑ͮΒ͍
    㱺 ΞΫςΟϒͳϢʔβʔ਺ΛҰఆҎ্ʹอͭͨΊʹ
    ෼͔Ε͍ͯΔϫʔϧυΛ౷߹͍ͨ͠

    View full-size slide

  15. ͱ͜ΖͰϫʔϧυ௥Ճ࣌ͷ࣮૷͸…
    ·ͬͨ͘ผͷγεςϜΛ
    ΋͏Ұݸཱͯͨঢ়ଶ
    ELB, ΞϓϦέʔγϣϯαʔό, Aurora,
    ElastiCache, ...
    Auroraʹೖ͍ͬͯΔσʔλͷID͸
    AUTO_INCREMENT Ͱൃ൪
    INSERT ͞ΕΔ͝ͱʹ1ͣͭࣗಈͰ૿͑
    ͍ͯ͘஋͕ओΩʔ
    㱺 ϫʔϧυA/BͰσʔλͷID͕ॏෳ

    View full-size slide

  16. σʔλͷID͕ॏෳɺͱ͸
    ͭ·Γ౷߹લ͸͜͏
    • ϫʔϧυA/Bͷ player.id = 100͸
    શ͘ͷผਓ
    • ϫʔϧυA/Bͷ player_item.id = 1000
    ͸׬શʹผ෺
    • player_item.player_id = 100
    ͕ࢀর͢Δઌ(player.id)΋౰વผਓ
    Ͳ͏ͨ͠Β…

    View full-size slide

  17. ຅Ҋ
    • શͯͷσʔλΛϫʔϧυΛؚΊͨෳ߹ओΩʔʹ͢Δ
    !
    ΞϓϦέʔγϣϯͷมߋൣғ͕େ͖͗͢Δ
    (ίʔυͱςετΛ߹Θͤͯ50ສߦఔ౓͋ΔͷͰ…)
    • ҠߦظؒΛઃ͚ͯͦΕͧΕͷϢʔβʔʹखଓ͖Λͯ͠΋Β͏
    →Ϣʔβʔσʔλ୯ҐͰόονॲཧͰҠߦ
    !
    ͦ͜Ͱڈͬͯ͠·͏Ϣʔβʔ͕େྔʹग़ΔՄೳੑ

    View full-size slide

  18. ཁ݅
    ʮϢʔβʔ͸Կ΋͠ͳ͍Ͱ΋ɺ৽͍͠ϫʔϧυͰήʔϜ͕ܧଓͰ͖Δʯ
    ݱঢ়
    • ֎෦ʹ಺෦ͷIDΛ࿐ग़͍ͯ͠Δͱ͜Ζ͸ͳ͍
    • ͭ·Γ಺෦ͷID͸ɺ੔߹ੑ͕อ͍ͯͯΕ͹ผͷ஋ʹͯ͠Α͍
    ͭ·Γ
    ֤ϫʔϧυʹଘࡏ͢ΔશϢʔβʔσʔλͷID(֎෦ࢀরؚΉ)Λ
    িಥ͠ͳ͍Α͏ʹ͢΂ͯॻ͖׵͑Ε͹Α͍
    ຊ౰ʹ΍Δͷ…?

    View full-size slide

  19. ;ͨͭͷσʔλϕʔεΛͻͱͭʹ

    View full-size slide

  20. ID ΛৼΓ௚͢
    ϫʔϧυAͷϢʔβʔσʔλͷIDͱϫʔϧυBͷIDΛ
    ॏෳ͠ͳ͍Α͏ʹશͯ࠶ൃ൪͢Δ
    • ͻͱͭͷςʔϒϧʹ͸࠷େͰ਺ԯߦ
    • ͋ΔςʔϒϧͷID͸ଞͷςʔϒϧͷΧϥϜʹؚ·ΕΔ(֎෦ࢀর)
    • ςʔϒϧ਺500Ҏ্
    • ༰ྔ͸2ϫʔϧυ߹ܭ1TBఔ౓ (Aurora snapshotͷαΠζͰ)
    ͜ΕΛશͯໃ६ͳ͘ॻ͖׵͑ͳ͍ͱ͍͚ͳ͍

    View full-size slide

  21. ID ରԠදΛ࣋ͭ?
    ͨͱ͑͹id_mapςʔϒϧʹ৽چIDͷରԠදΛ࡞Δ?
    world old_id new_id
    A 1 1
    B 1 2
    A 2 3
    ... ... ...
    A 9999 19999
    B 9999 20000
    A 10000 20001
    B 10000 20002
    ... ... ...

    View full-size slide

  22. world old_id new_id
    A 9999 19999
    B 9999 20000
    UPDATE player SET id=(SELECT new_id FROM id_map
    WHERE old_id=player.id AND world='A');
    UPDATE player_item
    SET id=(SELECT new_id FROM id_map
    WHERE old_id=player_item.id AND world='A'),
    player_id=(SELECT new_id FROM id_map
    WHERE old_id=player_item.player_id AND world='A');
    ͜ͷαϒΫΤϦͰ਺ेԯߦΛUPDATE……ͭΒͦ͏

    View full-size slide

  23. !
    ౷߹ = shardingͷٯૢ࡞Ͱ͸…?

    View full-size slide

  24. ҰൠతͳγϟʔσΟϯά
    γϟʔσΟϯά(sharding)
    = σʔλΛ෼ׂͯ͠ෳ਺σʔλϕʔεʹ֨ೲ
    id data
    2 AAA
    3 BBB
    4 CCC
    5 DDD
    Ұ൪୯७ͳͷ͸IDͷ৒༨(mod)ͰৼΓ෼͚
    ϫʔϧυA:
    id data
    2 AAA
    4 CCC
    ϫʔϧυB:
    id data
    3 BBB
    5 DDD

    View full-size slide

  25. ࠓճ͸෼ׂͰ͸ͳ͘౷߹ͳͷͰٯʹ͢Δ
    ϫʔϧυA: ৽͍͠IDΛ ʹ͢Δ
    data id new_id
    AAA 1 → 2
    CCC 2 → 4
    ϫʔϧυB: ৽͍͠IDΛ ʹ͢Δ
    data id new_id
    BBB 1 → 3
    DDD 2 → 5
    ͷIDͱ ͷID͸
    ౷߹ͯ͠΋িಥ͠ͳ͍ʂ
    data id
    AAA 2
    BBB 3
    CCC 4
    DDD 5

    View full-size slide

  26. SQLͰ΋αϒΫΤϦͳ͠Ͱ؆୯ܭࢉ
    UPDATE player SET id=(id * 2 + 1);
    UPDATE player_item
    SET id=(id * 2 + 1),
    player_id=(player_id * 2 + 1);
    ͢΂ͯͷม׵ޙͷIDΛ͋Β͔͡ΊܾఆతʹٻΊΒΕΔ
    IDৼΓ௚͠໰୊͸ղܾʂ (ͨͩ͠ʮٕज़తʹ͸Մೳʯঢ়ଶ)

    View full-size slide

  27. Amazon Aurora Λ׆༻ͨ͠
    ߴ଎ͳσʔλҠߦͱݕূ

    View full-size slide

  28. σʔλͷexportͱimportํ๏Λݕ౼
    ୯७ͳํ๏: Aurora MySQL ͔Β mysqldump
    1. UPDATE player SET id=(id * 2 + shard_id)...
    2. mysqldump > dump.sql
    3. mysql < dump.sql
    িಥͤ͞ͳ͍ͨΊʹ͸ɺઌʹIDΛॻ͖׵͔͑ͯΒdump͢Δඞཁ͕͋Δ
    • ࠷ॳͷUPDATEͰֻ͕͔࣌ؒΓͦ͏
    • ਺ඦGBͷdumpσʔλ(SQL)ΛऔΓ͜Ήͱ1೔ʙ਺೔Ϩϕϧ(ܦݧଇ)
    ϝϯςφϯε͸Ͱ͖Δ͚ͩ୹͍ͨ͘͠

    View full-size slide

  29. mysqldump Ҏ֎ͷํ๏Λߟ͑Δ
    • ڊେςʔϒϧͷUPDATEʹ͸ֻ͕͔࣌ؒΔ
    㱺 import͢ΔσʔλࣗମΛIDॻ͖׵͑ޙͷঢ়ଶʹ͍ͨ͠
    • ߴ଎ԽͷͨΊɺฒྻॲཧΛ͍ͨ͠
    㱺 ςʔϒϧ୯ҐͰ෼ׂͯ͠ॲཧ (͜Ε͸mysqldumpͰ΋Մೳ)
    ʮAmazon Aurora MySQL ͔Β Amazon S3 ʹσʔλΛ
    ΤΫεϙʔτ͓ΑͼΠϯϙʔτ͢ΔͨΊͷϕετϓϥΫςΟεʯ1
    1 https://aws.amazon.com/jp/blogs/news/best-practices-for-exporting-and-importing-data-from-amazon-aurora-mysql-to-
    amazon-s3/

    View full-size slide

  30. SELECT INTO OUTFILE S3 ͱ LOAD DATA FROM S3
    1. ΫΤϦ݁ՌΛ Amazon S3 ʹ CSV ͱͯ͠
    export
    2. CSV Λ S3 ͔ΒಡΈࠐΜͰςʔϒϧʹ
    import
    ςʔϒϧ୯ҐͰฒྻॲཧ͕Մೳ
    Aurora 㱻 S3 ؒͰॲཧ͕׬݁

    View full-size slide

  31. SELECT INTO OUTFILE S3
    mysqldumpͱ͸ҧ͍ɺ೚ҙͷΫΤϦ݁ՌΛS3ʹ௚઀ग़ྗͰ͖Δ
    IDॻ͖׵͑ࡁΈͷCSV͕ग़ྗͰ͖ΔͷͰɺͦͷ··औΓ͜ΊΔ
    㱺 ڊେςʔϒϧͷ UPDATE ͕ෆཁʹ
    SELECT id*2+1 AS id, foo, bar, ... -- IDΛॻ͖׵͑ͯ͠·͏
    FROM player
    INTO OUTFILE S3 's3://...'
    FIELDS TERMINATED BY ','
    LINES TERMINATED BY '\\n'
    MANIFEST ON;
    MANIFEST ON : ڊେͳςʔϒϧͷ৔߹ɺෳ਺S3 objectʹ෼ׂ͞ΕΔ
    objectҰཡ͕هࡌ͞ΕΔϚχϑΣετϑΝΠϧΛग़ྗ͢Δ

    View full-size slide

  32. LOAD DATA FROM S3
    S3ʹଘࡏ͍ͯ͠ΔCSVΛςʔϒϧʹऔΓ͜Ή
    LOAD DATA FROM S3 MANIFEST 's3://...'
    INTO TABLE player
    FIELDS TERMINATED BY ','
    LINES TERMINATED BY '\\n'
    (id, foo, bar, ...)
    SELECT INTO OUTFILE S3 Ͱग़ྗͨ͠ MANIFEST Λ
    ࢦఆͯ͠औΓࠐΈ

    View full-size slide

  33. ฒྻॲཧ͕Մೳ
    SELECT INTO OUTFILE S3 ͱ
    LOAD DATA FROM S3 ͸
    ෳ਺ηογϣϯͰಉ࣌ʹൃߦՄೳ
    σʔλ͸ Aurora 㱻 S3 ؒͰ௚઀సૹ͞ΕΔ
    ΫΤϦൃߦݩʹ͸ෛՙֻ͕͔Βͳ͍
    AuroraͷϚϧνίΞͱڧྗͳετϨʔδ
    S3 ͷྗΛଘ෼ʹ׆༻Ͱ͖Δʂ

    View full-size slide

  34. ෦෼తͳϦτϥΠΛ༰қʹ
    ςʔϒϧ୯ҐͰexport, import͢Δ
    ࣦഊΛݕ஌ͨ͠Βͦͷςʔϒϧ͚ͩϦτϥΠՄೳ
    λεΫΛࡉ͔͘෼ׂ + ฒྻ࣮ߦͰεϧʔϓοτΛՔ͙
    㱺 λεΫͷࣦഊΛલఏʹɺΫϥ΢υͷྗΛ׆༻͢Δ
    Α͘ͳ͍΍Γํͷྫ
    $ mysqldump -h src.host mydb | mysql -h dest.host
    EC2(ͳͲ)ͷ1୆ʹෛՙֻ͕͔Δ
    ్தͷͲ͔͜Ͱࣦഊ͢ΔͱϦτϥΠ͕ࠔ೉
    Auroraଆ΋1ίΞ͔͠࢖͑ͳ͍

    View full-size slide

  35. ਺ඦςʔϒϧʹରͯ͠ SQL Λੜ੒͢Δ
    खͰ͸ແཧͳͷͰ Perl ͷεΫϦϓτͰ……
    1. show tables ͰςʔϒϧҰཡΛऔಘ
    2. ࣄલʹચ͍ग़ͨ͠ςʔϒϧ໊ɺΧϥϜ໊Λݩʹ
    IDม׵͕ඞཁͳςʔϒϧʹ͍ͭͯ
    SELECT INTO OUTFILE S3
    LOAD DATA FROM S3
    ͷSQLΛੜ੒

    View full-size slide

  36. IDม׵ର৅ͷચ͍ग़͠ͱϧʔϧԽ
    xxx_id ͱ͍͏໊લ͕෇͍͍ͯΕ
    ͹େ఍͸ม׵ର৅
    ͨͩ͠Ϛελʔσʔλ͸ม׵ର৅
    Ͱ͸ͳ͍ͷͰআ֎
    ஍ಓͳચ͍ग़͠࡞ۀͰϧʔϧԽ
    # ඞͣIDม׵ͷର৅ʹ͢ΔΧϥϜ໊
    # ͜͜Ͱఆٛ͞Ε͍ͯΔ΋ͷ +
    # ***_idͱͭ͘΋ͷͰϚελʔσʔλςʔϒϧ͕
    # ଘࡏ͠ͳ͍΋ͷ͕IDม׵ͷର৅
    my $REQUIRED_CONVERT_COLUMN = {
    id => 1,
    team_id => 1,
    team_name_id => 1
    };
    # IDม׵ͷର৅ʹؚΊͳ͍ΧϥϜ໊
    my $IGNORE_CONVERT_COLUMN = {
    synced_league_id => 1,
    growth_lock_league_id => 1,
    post_id => 1,
    farm_league_id => 1,
    character_id => 1,
    # ...

    View full-size slide

  37. ෬ฌ JSON ΧϥϜ
    ʮจࣈྻܕͷΧϥϜʹJSON͕ೖ͍ͬͯͯID͕ຒ·͍ͬͯΔʯ
    MySQL5.6 ޓ׵ͩͬͨͨΊɺJSON ܕͰ͸ͳ͍ී௨ͷTEXTܕ
    Ҡߦ͕ඞཁͳର৅͸਺ςʔϒϧ͚ͩͩͬͨ(Α͔ͬͨ…)
    ΞϓϦέʔγϣϯͰಡΜͰॻ͖׵͑ΔରԠ

    View full-size slide

  38. ؆୯ͦ͏ʹॻ͖·͕ͨ͠…
    ҠߦεΫϦϓτ׬੒ʹ3ϲ݄
    2021-03-09 IDม׵ɺSQLΛग़ྗ͢ΔεΫϦϓτ։ൃ։࢝
    (໿50ίϛοτ)
    2021-06-14 ׬੒
    ྫ֎͕ଟ͗͢ΔͨΊɺಈ͔ͯ͠͸ςετ(CI, QA)
    Λ܁Γฦͯ͠໰୊Λ௵͍ͯ͘͠ඞཁ͕͋ͬͨ

    View full-size slide

  39. QAͱϦϋʔαϧ
    খ͍͞σʔλ͔ΒCI, QA؀ڥʹσʔλΛ౷߹͢ΔπʔϧΛ࡞੒
    CI, QA(ਓྗ)Ͱ໰୊఺Λચ͍ग़͠
    㱺 QA͸10ճҎ্࣮ࢪͯ͠໰୊Λચ͍ग़ͨ͠
    ຊ൪ͷεφοϓγϣοτ͔ΒAuroraΫϥελΛ෮ݩ
    export, import ΛεΫϦϓτͰ࣮ߦ
    ్த໰୊͕ى͖ͨΒεΫϦϓτΛमਖ਼ͯ͠΍Γͳ͓͠
    ໰୊ͳ͘౷߹DB͕Ͱ͖ͨΒ QA ࣮ߦ
    ຊ൪σʔλͰ5,6ճϦϋʔαϧ

    View full-size slide

  40. Կ౓΋ຊ൪ͷσʔλͰϦϋʔαϧ͢ΔͨΊʹ
    TerraformͰsnapshot͔ΒͷAuroraΫϥελ෮ݩΛࣗಈԽ
    ࠷৽ͷεφοϓγϣοτIDͰ terraform apply ͢Δ͚ͩ
    ਺ඦGBͷΫϥελͰ΋1࣌ؒఔ౓
    ࣮֬ʹಉ͡ઃఆͰ෮ݩͰ͖Δ
    resource "aws_rds_cluster" "restore" {
    cluster_identifier = "restore-cluster"
    engine = "aurora"
    engine_version = "5.6.mysql_aurora.1.19.5"
    snapshot_identifier = "arn:aws:rds:ap-northeast-1:..." // ←͚ͩ͜͜ॻ͖׵͑Δ
    // ...

    View full-size slide

  41. ͦͷଞɺࡉ͔͍޻෉ͳͲ
    े਺ຊɺܭ3000ߦ΄ͲͷPerl script͕ੜΈग़͞Εͨ
    • ηΧϯμϦΠϯσοΫεΛ DROP, ADD ͢Δ SQLจ΋ੜ੒
    • import࣌͸ηΧϯμϦΠϯσοΫε͕ͳ͍ํ͕ߴ଎
    • importޙʹ·ͱΊͯ ADD INDEX ͢Δ
    • SELECT ࣌ʹ count(*) ͰҠߦର৅ͷߦ਺ΛϑΝΠϧʹه࿥
    • LOAD ޙʹ count(*) ͨ݁͠Ռͱಥ͖߹ΘͤΔ
    • Ͳ͏ͯ͠΋ॏෳͯ͠͠·͏ϨίʔυΛͳΜͱ͔͢Δ
    • ֎෦αʔϏεͷID͕ه࿥͞Ε͍ͯΔςʔϒϧͰॏෳͳͲ
    • ΞϓϦέʔγϣϯཁ݅ʹैͬͯ৽͍͠΄͏Λ࢒͢ͳͲରॲ

    View full-size slide

  42. Ϧϋʔαϧͷ݁Ռ
    export, import ͸ෳ਺ϓϩηεͰฒྻ࣮ߦ͢Δ
    Aurora(౷߹લ r5.4xlarge 16ίΞ, ౷߹ޙ r5.8xlarge 32ίΞ)
    ͱS3ͷੑೳΛҾ͖ग़ͨ͢Ί
    export 16ฒྻɺimport 32ฒྻͰ࣮ߦ
    ਺ඦGBͷIDॻ͖׵͑ͱσʔλҠߦ͕2࣌ؒͰ׬ྃʂ

    View full-size slide

  43. ϦϋʔαϧͰൃ֮ͨ͠໰୊
    importޙɺADD INDEX Λ32ฒྻͰ࣮ߦ͍ͯͨ͠ͱ͜Ζ…
    Aurora ͷۭ͖ϝϞϦ͕ރׇͯ͠ΫϥογϡˠϑΣΠϧΦʔόʔ
    ଴ͬͯ΋ճ෮͠ͳ͍
    ฒྻ౓Λམͱͯ͠΋ރׇ͕؇΍͔ʹͳΔ͚ͩ
    ADD INDEX Λ൒෼΄Ͳ࣮ߦޙɺAuroraΠϯελϯεΛ࠶ىಈ
    ࠶ىಈޙʹ͸ϝϞϦ໰୊ͳ͠
    ͕࣌ؒͳ͔ͬͨͨΊݪҼ௥ٴ͸ఘΊͯ࠶ىಈͰ৐Γ੾Δ͜ͱʹ

    View full-size slide

  44. ࣮ࡍͷ౷߹ϝϯςφϯε
    2021-07-04(೔) 24:00 ϝϯςφϯε։࢝
    2021-07-05(݄) ऴ೔ϝϯςφϯε
    2021-07-06(Ր) 10:00 ౷߹ϫʔϧυΦʔϓϯ
    ߹ܭ34࣌ؒͷϝϯςφϯε
    ࣮ͨͩ͠ಇ͸12࣌ؒఔ౓
    ʲ໨ඪʳͪΌΜͱ৸Δ

    View full-size slide

  45. ࣮ࡍͷ౷߹ϝϯςφϯε(1೔໨)
    2021-07-04(೔) 24:00 (ਂ໷0࣌)
    ϝϯςφϯε։࢝
    1. ֤ϫʔϧυͰεφοϓγϣοτऔಘ
    2. εφοϓγϣοτ͔ΒҠߦ༻Ϋϥε
    λΛ෮ݩ
    3. 01:30 AM ࠒ׬੒ͨ͠ͷͰղࢄ
    ݩͷΫϥελ͸ͦͷ··࢒͓ͯ͘͠
    ࠷ѱɺ౷߹લͷঢ়ଶʹ੾Γ໭ͨ͢Ί

    View full-size slide

  46. ࣮ࡍͷ౷߹ϝϯςφϯε(2೔໨)
    2021-07-05(݄)
    09:00 export։࢝
    11:00 import׬ྃ
    14:00 ࣄޙॲཧؚΊͯσʔλҠߦ׬ྃ
    17:00 ಈ࡞֬ೝ׬ྃɻΞϓϦετΞެ։࡞ۀ
    19:00 ղࢄ

    View full-size slide

  47. ࣮ࡍͷ౷߹ϝϯςφϯε(3೔໨)
    2021-07-06(Ր)
    09:00 ΞϓϦετΞެ։Λ֬ೝ
    10:00 ϝϯςφϯεղআɻ౷߹ϫʔϧυͰΦʔϓϯ
    ࡉ͔͍໰୊͸͍͔ͭ͋ͬͨ͘΋ͷͷ
    σʔλҠߦʹ·ͭΘΔେ͖ͳ໰୊͸ൃੜͤͣ
    ແࣄނͰ׬ྃʂ
    !
    ਭ຾΋͔ͬ͠ΓऔΕͨ

    View full-size slide

  48. ·ͱΊ
    ϦϦʔε͔Β7प೥Λܴ͑ͨʮ΅͘ΒͷߕࢠԂʂϙέοτʯͰ͸
    ผʑͷσʔλϕʔεʹଘࡏ͍ͯͨ͠;ͨͭͷϫʔϧυΛ
    ͻͱͭʹ౷߹͠·ͨ͠
    Amazon AuroraͷػೳΛ׆༻͢Δ͜ͱͰɺ
    ෳࡶͳॻ͖׵͑Λ൐͏େྔͷσʔλҠߦΛ
    ҆શʹ࣮ࢪ͢Δ͜ͱ͕Ͱ͖·ͨ͠
    • Aurora㱻S3ؒͷσʔλίϐʔΛฒྻ࣮ߦͰߴ଎ʹ
    • εφοϓγϣοτ͔Βͷ෮ݩͰසൟͳϦϋʔαϧΛՄೳʹ

    View full-size slide