[2/2]
ã©ããã£ãŠãã£ãã®
ã¢ããªã±ãŒã·ã§ã³ã®ããã©ãŒãã³ã¹ãåäžãããããã«GCPã«åãæ¿ããããšã決å®ããŸãã-èŠæš¡ãæ¡å€§ããŸããã倧ããªã³ã¹ãã¯ããããŸããã ããã»ã¹å šäœã«2ãæ以äžããããŸããã ãã®åé¡ã解決ããããã«ãç¹å¥ãªãšã³ãžãã¢ã°ã«ãŒããç·šæããŸããã
ãã®åºçç©ã§ã¯ãéžæãããã¢ãããŒããšãã®å®è£ ãããã³äž»ãªç®æšãã©ã®ããã«éæãããã«ã€ããŠè©±ããŸãããã®ããã»ã¹ãå¯èœãªéãã¹ã ãŒãºã«å®è£ ãããŠãŒã¶ãŒãµãŒãã¹ã®å質ãæãªãããšãªãã€ã³ãã©ã¹ãã©ã¯ãã£å šäœãGoogle Cloud Platformã«ç§»è¡ããŸãã
èšç»äž
- å¯èœãªåã¹ããããèå¥ãã詳现ãªãã§ãã¯ãªã¹ããçšæãããŠããŸãã ã·ãŒã±ã³ã¹ã説æãããããŒãã£ãŒããäœæãããŸããã
- ãªã»ãããã©ã³ãéçºãããŠããããããããã°ã䜿çšã§ããŸãã
ããã€ãã®ãã¬ãŒã³ã¹ããŒãã³ã°ã»ãã·ã§ã³-ãããŠãã¢ã¯ãã£ã/ã¢ã¯ãã£ãã¹ããŒã ãå®è£ ããããã®æãç解ããããæãç°¡åãªã¢ãããŒããç¹å®ããŸããã ããã¯ãå°æ°ã®ãŠãŒã¶ãŒã1ã€ã®ã¯ã©ãŠãã«é 眮ãããæ®ãã®ãŠãŒã¶ãŒãå¥ã®ã¯ã©ãŠãã«é 眮ããããšããäºå®ã«åºã¥ããŠããŸãã ãã ãããã®ã¢ãããŒãã¯ãç¹ã«ã¯ã©ã€ã¢ã³ãåŽïŒDNS管çã«é¢é£ããïŒã§åé¡ãåŒãèµ·ãããããŒã¿ããŒã¹è€è£œã®é 延ã«ã€ãªãããŸããã ãã®ãããå®å šã«å®è£ ããããšã¯ã»ãšãã©äžå¯èœã§ããã æãããªæ¹æ³ã§ã¯å¿ èŠãªè§£æ±ºçãåŸãããªãã£ããããç¹å¥ãªæŠç¥ãéçºããå¿ èŠããããŸããã
äŸåé¢ä¿å³ãšéçšäžã®å®å šèŠä»¶ã«åºã¥ããŠãã€ã³ãã©ã¹ãã©ã¯ãã£ãµãŒãã¹ã9ã€ã®ã¢ãžã¥ãŒã«ã«åå²ããŸããã
ïŒãã¹ãã£ã³ã°ã€ã³ãã©ã¹ãã©ã¯ãã£ãå±éããããã®åºæ¬ã¢ãžã¥ãŒã«ïŒ
åã€ã³ãã©ã¹ãã©ã¯ãã£ã°ã«ãŒãã¯ãå ±éã®å éšããã³å€éšãµãŒãã¹ã管çããŸããã
â¹ ã€ã³ãã©ã¹ãã©ã¯ãã£ã¡ãã»ãŒãžã³ã°ãµãŒãã¹ ïŒMQTTãHTTPãThriftãGunicornãµãŒããŒããã¥ãŒã€ã³ã°ã¢ãžã¥ãŒã«ãéåæã¯ã©ã€ã¢ã³ããJettyãµãŒããŒãKafkaã¯ã©ã¹ã¿ãŒã
â¹ ããŒã¿ãŠã§ã¢ããŠã¹ãµãŒãã¹ ïŒåæ£ã¯ã©ã¹ã¿ãŒMongoDBãRedisãCassandraãHbaseãMySQLãããã³MongoDBã
â¹ ã€ã³ãã©ã¹ãã©ã¯ãã£åæãµãŒãã¹ ïŒKafkaã¯ã©ã¹ã¿ãŒãããŒã¿ãŠã§ã¢ããŠã¹ã¯ã©ã¹ã¿ãŒïŒHDFSãHIVEïŒã
éèŠãªæ¥ã®æºåïŒ
âåãµãŒãã¹ã®GCPã«åãæ¿ããããã®è©³çŽ°ãªèšç»ïŒã·ãŒã±ã³ã¹ãããŒã¿ãŠã§ã¢ããŠã¹ããªã»ããã®èšç»ã
âGCPã§ã®ãããžã§ã¯ãéã®ãããã¯ãŒã¯ã€ã³ã¿ã©ã¯ã·ã§ã³ïŒå
±æä»®æ³ãã©ã€ããŒãã¯ã©ãŠãVPC [XPN]ïŒã«ãããã€ã³ãã©ã¹ãã©ã¯ãã£ã®ããŸããŸãªéšåãåé¢ãã管çãæé©åããã»ãã¥ãªãã£ãšæ¥ç¶æ§ãæ¹åããŸãã
âGCPãšå®è¡äžã®ä»®æ³ãã©ã€ããŒãã¯ã©ãŠãïŒVPCïŒã®éã®è€æ°ã®VPNãã³ãã«ã«ãããè€è£œäžã®ãããã¯ãŒã¯äžã§ã®å€§éããŒã¿ã®è»¢éãç°¡çŽ åãããã®åŸã®äžŠåã·ã¹ãã ã®å±éãå¯èœã«ããŸãã
âChefã·ã¹ãã ã䜿çšããŠãã¹ã¿ãã¯å
šäœã®ã€ã³ã¹ããŒã«ãšæ§æãèªååããŸãã
âå±éãç£èŠããã°èšé²ãªã©ã®ããã®ã¹ã¯ãªãããšèªååããŒã«
âã·ã¹ãã ã¹ããªãŒã ã«å¿
èŠãªãã¹ãŠã®ãµãããããšç®¡çããããã¡ã€ã¢ãŠã©ãŒã«ã«ãŒã«ãæ§æããŸãã
âãã¹ãŠã®ã¹ãã¬ãŒãžã·ã¹ãã ã®è€æ°ã®ããŒã¿ã»ã³ã¿ãŒïŒãã«ãDCïŒã§ã®ã¬ããªã±ãŒã·ã§ã³ã
âããŒããã©ã³ãµãŒïŒGLB / ILBïŒããã³ãããŒãžãã€ã³ã¹ã¿ã³ã¹ã°ã«ãŒãïŒMIGïŒãæ§æããŸãã
âãªããžã§ã¯ãã¹ãã¬ãŒãžã³ã³ãããŒããã§ãã¯ãã€ã³ãä»ãã®GCP Cloud Storageã«è»¢éããããã®ã¹ã¯ãªãããšã³ãŒãã
ããã«ãå¿ èŠãªåææ¡ä»¶ããã¹ãŠæºãããã€ã³ãã©ã¹ãã©ã¯ãã£ãGCPãã©ãããã©ãŒã ã«ç§»è¡ããããã®èŠçŽ ã®ãã§ãã¯ãªã¹ããäœæããŸããã å€æ°ã®è°è«ãè¡ãããµãŒãã¹ã®æ°ãšãã®äŸåé¢ä¿å³ãæ€èšããåŸã3æ©ã§ã¯ã©ãŠãã€ã³ãã©ã¹ãã©ã¯ãã£ãGCPã«ç§»è¡ããŠããã¹ãŠã®ãµãŒããŒåŽããã³ããŒã¿ã¹ãã¬ãŒãžãµãŒãã¹ãã«ããŒããããšã«ããŸããã
移è¡
ããŒããã©ã³ãµãŒã®è»¢éæŠç¥ïŒ
以å䜿çšããŠããHAProxy管çã¯ã©ã¹ã¿ãŒãã°ããŒãã«ããŒããã©ã³ãµãŒã«çœ®ãæããŠãæ¯æ¥æ°åäžã®ã¢ã¯ãã£ããªãŠãŒã¶ãŒæ¥ç¶ãåŠçããŸããã
â¹ ã¹ããŒãž1ïŒ
- MIGã¯ããã¹ãŠã®ãã©ãã£ãã¯ãæ¢åã®ã¯ã©ãŠãã®MQTT IPã¢ãã¬ã¹ã«è»¢éããããã®ãã±ãã転éã«ãŒã«ã§äœæãããŠããŸãã
- ãµãŒããŒããŒããšããŠMIGã䜿çšããŠSSLããã³TCPãããã·ãã©ã³ãµãŒãäœæãããŸããã
- MIGã®å ŽåããµãŒããŒããŒããšããŠMQTTãµãŒããŒã䜿çšããŠHAProxyãèµ·åãããŸãã
- DNSã§ã¯ãéã¿ä»ãéã¿ä»ãã«ãŒãã£ã³ã°ããªã·ãŒã«ãããå€éšGLB IPã¢ãã¬ã¹ãè¿œå ãããŸããã
ãŠãŒã¶ãŒæ¥ç¶ã¯ãããã©ãŒãã³ã¹ã远跡ããªããåŸã ã«å±éãããŸãã
â¹ ã¹ããã2ïŒãã€ã«ã¹ããŒã³ã®ç§»è¡ãGCPã§ã®ãµãŒãã¹ã®å±éãéå§ããŸãã
â¹ ã¹ããŒãž3ïŒç§»è¡ã®æçµã¹ããŒãžããã¹ãŠã®ãµãŒãã¹ãGCPã«è»¢éãããŸãã
ïŒããŒããã©ã³ãµãŒã®è»¢éã®æ®µéïŒ
ãã®æ®µéã§ã¯ããã¹ãŠãæåŸ ã©ããã«æ©èœããŸããã ããã«ãä¿æ°ã®éã¿ãèæ ®ããŠãã«ãŒãã£ã³ã°ã䜿çšããŠGCPã«ããã€ãã®å éšHTTPãµãŒãã¹ãå±éãããšããããŸããã ãã¹ãŠã®ææšã«å³å¯ã«åŸããŸããã èšç»ããã移è¡ã®åæ¥ã«ãã©ãã£ãã¯ãåŸã ã«å¢å ãå§ãããšããVPNãä»ããVPCçžäºäœçšã®é 延ïŒ40ããªç§-100ããªç§ã®é 延ãèšé²ãããŸãããã以åã¯10ããªç§æªæºã§ããïŒãå¢å ããŸããã
ïŒ2ã€ã®VPCãçžäºäœçšãããšãã®ãããã¯ãŒã¯é 延ããã§ãã¯ããã¹ãããã·ã§ããïŒ
ç£èŠã«ãããVPNãã³ãã«ã䜿çšããäž¡æ¹ã®ã¯ã©ãŠãããŒã¹ã®ãããã¯ãŒã¯ãã£ãã«ã«åé¡ãããããšãæããã«ãªããŸããã VPNãã³ãã«ã®ã¹ã«ãŒãããã§ãããæé©ãªæ°Žæºã«éããŸããã§ããã ãã®ç¶æ³ã¯ãäžéšã®ãŠãŒã¶ãŒãµãŒãã¹ã«æªåœ±é¿ãåãŒãå§ããŠããŸãã 以åã«ç§»è¡ãããã¹ãŠã®HTTPãµãŒãã¹ãããã«å ã®ç¶æ ã«æ»ããŸããã TAMããã³ã¯ã©ãŠããµãŒãã¹ã®ãµããŒãããŒã ã«é£çµ¡ããå¿ èŠãªåæããŒã¿ãæäŸããŠãé 延ãå¢å€§ããçç±ãç解ãå§ããŸããã ãµããŒãã¹ãã·ã£ãªã¹ãã¯ã2ã€ã®ã¯ã©ãŠããµãŒãã¹ãããã€ããŒéã®ã¯ã©ãŠããã£ãã«ã§æ倧ãããã¯ãŒã¯åž¯åå¹ ãéæããããšããçµè«ã«éããŸããã ãããã£ãŠãå éšã·ã¹ãã ã®è»¢éäžã®ãããã¯ãŒã¯é 延ã®æé·ã
ãã®ã€ã³ã·ãã³ãã«ãããã¯ã©ãŠããžã®ç§»è¡ãäžæåæ¢ãããŸããã ã¯ã©ãŠããµãŒãã¹ãããã€ããŒã¯ã垯åå¹ ãååã«éãåå¢ã§ããŸããã§ããã ãããã£ãŠãèšç»æ®µéã«æ»ããæŠç¥ãä¿®æ£ããŸããã ã¯ã©ãŠãã€ã³ãã©ã¹ãã©ã¯ãã£ã®GCPãžã®ç§»è¡ã3æ³ã§ã¯ãªã1æ³ã§å®è¡ããããšã決å®ãããµãŒããŒéšåãšããŒã¿ã¹ãã¬ãŒãžã®ãã¹ãŠã®ãµãŒãã¹ãèšç»ã«å«ããŸããã ãXããšããæéã«ãªããšããã¹ãŠãã¹ã ãŒãºã«é²ã¿ãŸããããŠãŒã¶ãŒã«æ°ä»ãããããšãªããã¯ãŒã¯ããŒããæ£åžžã«Google Cloudã«è»¢éãããŸããã
ããŒã¿ããŒã¹ç§»è¡æŠç¥ïŒ
ãªã¬ãŒã·ã§ãã«DBMSãã¡ã¢ãªå ã¹ãã¬ãŒãžãããã³NoSQLãšäœé 延ã®åæ£ããã³ã¹ã±ãŒã©ãã«ãªã¯ã©ã¹ã¿ãŒã®ããã«ã50ãè¶ ããããŒã¿ããŒã¹ãšã³ããã€ã³ãã転éããå¿ èŠããããŸããã ãã¹ãŠã®ããŒã¿ããŒã¹ã®ã¬ããªã«ãGCPã«é 眮ããŸããã ããã¯ãHBaseãé€ããã¹ãŠã®å±éã§è¡ãããŸããã
â¹ ãã¹ã¿ãŒã¹ã¬ãŒãã¬ããªã±ãŒã·ã§ã³ïŒ MySQLãRedisãMongoDBãããã³MongoSã¯ã©ã¹ã¿ãŒã«å®è£
ãããŠããŸãã
ãã«ããã«ãDCã¬ããªã±ãŒã·ã§ã³ïŒ Cassandraã¯ã©ã¹ã¿ãŒã«å®è£
ãããŠããŸãã
â¹ ãã¥ã¢ã«ã¯ã©ã¹ã¿ãŒïŒãã©ã¬ã«ã¯ã©ã¹ã¿ãŒã¯ãGCPã§Gbaseçšã«æ§æãããŠããŸãã æ¢åã®ããŒã¿ã移è¡ããäž¡æ¹ã®ã¯ã©ã¹ã¿ãŒã§ããŒã¿ã®äžè²«æ§ãç¶æããæŠç¥ã«åŸã£ãŠäºéãšã³ããªãæ§æããŸããã
HBaseã®å Žåãåé¡ã¯Ambariã§èšå®ãããŠããŸããã è€æ°ã®ããŒã¿ã»ã³ã¿ãŒã«ã¯ã©ã¹ã¿ãŒãé 眮ãããšãã«ãããšãã°DNSãã©ãã¯èªèã¹ã¯ãªãããªã©ã®åé¡ãçºçãããããããã€ãã®åé¡ãçºçããŸããã
æåŸã®æé ïŒãµãŒããŒã移åããåŸïŒã«ã¯ãã¬ããªã«ãã¡ã€ã³ãµãŒããŒã«ç§»åããå€ãããŒã¿ããŒã¹ãã·ã£ããããŠã³ããããšãå«ãŸããŠããŸããã èšç»ã©ãããããŒã¿ããŒã¹è»¢éã®åªå 床ã決å®ããããã«ãã¢ããªã±ãŒã·ã§ã³ã¯ã©ã¹ã¿ãŒã®å¿ èŠãªæ§æã«Zookeeperã䜿çšããŸããã
ã¢ããªã±ãŒã·ã§ã³ãµãŒãã¹ã®ç§»è¡æŠç¥
ã¢ããªã±ãŒã·ã§ã³ãµãŒãã¹ã®ã¯ãŒã¯ããŒããçŸåšã®ãã¹ãã£ã³ã°ããGCPã¯ã©ãŠãã«è»¢éããããã«ããªããã¢ã³ãã·ããã¢ãããŒãã䜿çšããŸããã ã¢ããªã±ãŒã·ã§ã³ãµãŒãã¹ããšã«ãèªåã¹ã±ãŒãªã³ã°ã䜿çšãã管ç察象ã€ã³ã¹ã¿ã³ã¹ïŒMIGïŒã®ã°ã«ãŒããäœæããŸããã
詳现ãªèšç»ã«åŸã£ãŠãããŒã¿ãŠã§ã¢ããŠã¹ã®é åºãšäŸåé¢ä¿ãèæ ®ããŠããµãŒãã¹ãGCPã«ç§»è¡ãå§ããŸããã ãã¹ãŠã®ã¡ãã»ãŒãžã³ã°ã¹ã¿ãã¯ãµãŒãã¹ã¯ãããŠã³ã¿ã€ã ãªãã§GCPã«ç§»è¡ãããŸããã ã¯ããããã€ãã®å°ããªäžå ·åããããŸããããããã«å¯ŸåŠããŸããã
ååäžããŠãŒã¶ãŒã¢ã¯ãã£ããã£ãå¢å ããããããã¹ãŠã®ããã·ã¥ããŒããšã€ã³ãžã±ãŒã¿ãŒã泚ææ·±ãç£èŠããŠãåé¡ãè¿ éã«ç¹å®ããŸããã ããã€ãã®åé¡ãå®éã«çºçããŸããããããã«ããããæé€ããããšãã§ããŸããã åé¡ã®1ã€ã¯ãå éšããŒããã©ã³ãµãŒïŒILBïŒã®å¶éãåå ã§ãããILBã¯ãæ倧20,000ã®åææ¥ç¶ãåŠçã§ããŸãã ãããŠãããã«8åãå¿ èŠã§ããïŒ ãããã£ãŠãæ¥ç¶ç®¡çã¬ã€ã€ãŒã«ILBãè¿œå ããŸããã
移è¡åŸã®æåã®ããŒã¯è² è·ã§ã¯ãã¡ãã»ãŒãžã³ã°ã¹ã¿ãã¯ã®è² è·å šäœãGCPã«è»¢éãããããããã¹ãŠã®ãã©ã¡ãŒã¿ãŒãç¹ã«æ éã«å¶åŸ¡ããŸããã ããã€ãã®å°ããªäžå ·åããããŸããããããã«è§£æ±ºããŸããã ä»ã®ãµãŒãã¹ã移è¡ãããšãããåãã¢ãããŒããåããŸããã
ãªããžã§ã¯ãã¹ãã¬ãŒãžã®ç§»è¡ïŒ
ãªããžã§ã¯ãã¹ãã¬ãŒãžãµãŒãã¹ã¯ãäž»ã«3ã€ã®æ¹æ³ã§äœ¿çšããŸãã
personalããŒãœãã«ãã£ãããŸãã¯ã°ã«ãŒããã£ããã«éä¿¡ãããã¡ãã£ã¢ãã¡ã€ã«ã®ä¿åã ä¿åæéã¯ãã©ã€ããµã€ã¯ã«ç®¡çããªã·ãŒã«ãã£ãŠæ±ºå®ãããŸãã
userãŠãŒã¶ãŒãããã¡ã€ã«ã®ç»åãšãµã ãã€ã«ã®ä¿åã
sectionsã»ã¯ã·ã§ã³ãå±¥æŽãããã³ãã¿ã€ã ã©ã€ã³ãããã³å¯Ÿå¿ãããµã ãã€ã«ããã®ã¡ãã£ã¢ãã¡ã€ã«ã®ä¿åã
Googleã®ã¹ãã¬ãŒãžè»¢éããŒã«ã䜿çšããŠãS3ããGCSã«å€ããªããžã§ã¯ããã³ããŒããŸããã ãŸããã«ã¹ã¿ã ã®KafkaããŒã¹ã®MIGã䜿çšããŠãç¹å¥ãªããžãã¯ãå¿ èŠãªå Žåã«ãªããžã§ã¯ããS3ããGCSã«è»¢éããŸããã
S3ããGCSãžã®ç§»è¡ã«ã¯ã次ã®æé ãå«ãŸããŠããŸããã
âãªããžã§ã¯ãã¹ãã¢ã®æåã®ãŠãŒã¹ã±ãŒã¹ã§ã¯ãS3ãšGCSã®äž¡æ¹ã«æ°ããããŒã¿ã®æžã蟌ã¿ãéå§ããæå¹æéãåããåŸãã¢ããªã±ãŒã·ã§ã³åŽã®ããžãã¯ã䜿çšããŠGCSããããŒã¿ã®èªã¿åããéå§ããŸããã å€ãããŒã¿ã転éããã®ã¯çã«ããªã£ãŠãããããã®ã¢ãããŒãã¯è²»çšå¯Ÿå¹æã«åªããŠããŸãã
â2çªç®ãš3çªç®ã®ãŠãŒã¹ã±ãŒã¹ã§ã¯ãGCSã«æ°ãããªããžã§ã¯ãã®æžã蟌ã¿ãéå§ããããŒã¿ã®èªã¿åããã¹ãå€æŽããŠãæåã«GCSã§æ€çŽ¢ãå®è¡ããããã®åŸãªããžã§ã¯ããèŠã€ãããªãå Žåã®ã¿S3ã§å®è¡ãããããã«ããŸããã
èšç»ãã³ã³ã»ããã®æ£ç¢ºæ§ã®ç¢ºèªãæºåãšãããã¿ã€ãã®äœæã«ã¯æ°ãæããããŸãããããã®åŸã移è¡ã決å®ããéåžžã«è¿
éã«å®è£
ããŸããã ãªã¹ã¯ãè©äŸ¡ããçµæãé«é移è¡ãæãŸããããšã§ãããã»ãšãã©èªèã§ããªãããšãããããŸããã
ãã®å€§èŠæš¡ãããžã§ã¯ãã¯ãã¯ã©ãŠãã€ã³ãã©ã¹ãã©ã¯ãã£ã®ç®¡çã«é¢ããæåæäœã®ã»ãšãã©ãéå»ã®ãã®ã§ãããããå€ãã®åéã§èªä¿¡ãæã£ãŠããŒã ã®çç£æ§ãåäžãããã®ã«åœ¹ç«ã¡ãŸããã
âãŠãŒã¶ãŒã«ã€ããŠã¯ãæé«ã®ãµãŒãã¹å質ã確ä¿ããããã«å¿
èŠãªãã¹ãŠã®ãã®ãåãåããŸããã ããŠã³ã¿ã€ã ã¯ã»ãšãã©ãªããªããæ°ããæ©èœãããéãå®è£
ãããŠããŸãã
âåœç€Ÿã®ããŒã ã¯ãã¡ã³ããã³ã¹ã¿ã¹ã¯ã«è²»ããæéãççž®ããèªååãããžã§ã¯ããšæ°ããããŒã«ã®äœæã«éäžã§ããŸãã
âããã°ããŒã¿ãæäœããããã®åäŸã®ãªãããŒã«ã»ããã«å ããæ©æ¢°åŠç¿ãšåæã®ããã®æ¢è£œã®æ©èœã«ã¢ã¯ã»ã¹ã§ããŸããã 詳现ã¯ãã¡ããã芧ãã ããã
â KubernetesãªãŒãã³ãœãŒã¹ãããžã§ã¯ãã§ã®äœæ¥ã«å¯ŸããGoogle Cloudã®ã³ãããã¡ã³ãã¯ãä»å¹Žã®éçºèšç»ã«ã沿ã£ãŠããŸãã