ãã®èšäºã¯ã
Containers- Linuxã§ã® ã¯ã©ãŠããš
Containerizationã®è©³çŽ°-LXCãšOpenVZã®åºçç©ã§å§ãŸã£ãã·ãªãŒãºã®ç¶ãã§ã
ã ããŒã1æªæ¥ã«ã€ããŠã®åºçç©ãã¹ãããã§ããå ŽåãèšäºãããŒã1ãã¯ãç§ãã¡ã話ããŠããããšãç解ããããã«èªãå¿
èŠããããŸãã
ã³ã³ããããŒããŠã§ã¢ãªãœãŒã¹å¶éãµãã·ã¹ãã ã®æè¡çãªå®è£
説æãå®å
šã«ããããã«ãã·ã¹ãã ãªãœãŒã¹ãšæš©å©ã ãã§ãªããããŒããŠã§ã¢ãªãœãŒã¹ãåºåããšããåŽé¢ã«å¿
ã觊ããªããã°ãªããŸããã
ãŠãŒã¶ãŒéã§å
±æããå¿
èŠããããªãœãŒã¹ïŒ
- CPU
- ããŒããã£ã¹ã¯ïŒããŒãïŒ
- ã¡ã¢ãªïŒããªã¥ãŒã ïŒ
ãã®ãããªãã¹ãŠã®å¶éã«ã¯ãcgroupsãµãã·ã¹ãã ã䜿çšãããŸãã å
¥å/åºåè² è·ã¯cgroups blkioãµãã·ã¹ãã ã䜿çšããŠä¿®æ£ã§ããŸãããã€ã/ç§ããã³ãªãã¬ãŒã·ã§ã³/ç§ïŒIOPSïŒã§ããŒãå¶éãèšå®ããå¯èœæ§ãããã³éã¿ä¿æ°ïŒã€ãŸãã10ãµãŒããŒå
šäœã®ïŒ
ïŒã ã¡ã¢ãªã¯ã¡ã¢ãªcgroupã«ãã£ãŠå¶éãããŸããããã§ã¯ãã¹ãŠãéåžžã«åçŽã§ã-ã³ã³ããããããè¶
ããå ŽåãRAMã®éã瀺ããŸã-ããã»ã¹ã¯OOMã¡ãã»ãŒãžãåãåããŸãã ããã»ããµãŒã®å Žåãè² è·ãããŒã»ã³ãã§æå®ããæ©èœã®ã¿ãèš±å¯ãããŸããããã¯ãLinuxã§ã®ã¹ã±ãžã¥ãŒã©ãŒå®è£
ã®ç¹æ§ã«ãã£ãŠèª¬æãããŸãã
åèšããªãœãŒã¹äœ¿çšã®å·®å¥åãå®è£
ããããã«ã次ã®cgroupã䜿çšããŸããã
ã³ã³ãã䜿çšæã®äžè¬çãªåé¡
ã³ã³ããã®ãã¹ãŠã®å©ç¹ã
説æãããšããã³ã³ããã®æ¬ ç¹ã«å¯ŸåŠããªãããšãæå³çã«æ±ºããŸãããããã¯éåžžã«èšå€§ãªãããã¯ã§ãããå€ãã®èª¬æãå¿
èŠã ããã§ãã
ããã§ã¯ãè¡ããŸãããïŒ
- Linuxã¢ããã¹ããªãŒã ã³ã³ããã«ã¯ãã³ã³ããéã§/ procãã¡ã€ã«ã·ã¹ãã ãåé¢ããéã®åé¡ããããŸãã OpenVZã¯ãã®åé¡ã解決ããŸããã
- Linuxã¢ããã¹ããªãŒã ã³ã³ããã§ã¯ãå®å
šã«ç¬ç«ãããã¡ã€ã«ã·ã¹ãã ã䜿çšããã«ãã³ã³ããã§äœ¿çšå¯èœãªãã£ã¹ã¯ã®éãå¶éããããšã¯ã§ããŸããïŒããã¯ãäžäŸ¿ã§ãµããŒãã«éåžžã«äžäŸ¿ã§ãïŒã å°æ¥ãã®åé¡ã«å¯Ÿããææãªè§£æ±ºçãšããŠããµãããªã¥ãŒã ãã¡ã€ã«ã·ã¹ãã Btrfsã®æ©èœã«æ³šç®ãã䟡å€ããããŸããããã«ãããåããã¡ã€ã«ã·ã¹ãã å
ã«å®å
šã«éé¢ãããé åïŒåºå®ããªã¥ãŒã ïŒãäœæã§ããŸãã
- ã³ã³ããåã䜿çšããå Žåãç©çãµãŒããŒã§å®è¡ãããŠããã®ãšåãOSã®ã¿ãã¯ã©ã€ã¢ã³ãOSãšããŠäœ¿çšã§ããŸãã ããã¯æè¡çãªã³ã³ããã¹ãã®æ¬ é¥ã§ã¯ãªããå®è£
ã®æ©èœã§ãã ã€ãŸããç©çLinuxãã·ã³ã§å®è¡ã§ããã®ã¯Linuxã®ã¿ã§ãã å¥ã®OSãå®è¡ããå¿
èŠãããå ŽåãKVMã¯éåžžã«åªãããµãŒãã¹ãæäŸããŸããããã¯ãOpenVZã«ãŒãã«ãšLinuxã¢ããã¹ããªãŒã ã®äž¡æ¹ã§ååã«ãµããŒããããŠããŸãïŒæ£çŽãªãšããããã¡ãã®æ¹ãåªããŠããŸãïŒã
- å®å
šä»®æ³åãããã»ãã¥ãªãã£ãäœãã ã³ã³ããããããŒããŠã§ã¢ããŒãèªäœã®é害ã«ã€ãªãããšã¯ã¹ããã€ããäœæããå¯èœæ§ããããŸãã Linuxã«ãŒãã«ã®ã³ã³ãããŒã䜿çšããå ŽåãOpenVZã§ã®åé¢ãã¯ããã«æ¹åãããŠãããããããŒããŠã§ã¢ãµãŒããŒãç¡å¹ã«ããæ¹æ³ã®æ°ã決å®çã«å€ããªã£ãŠããŸãïŒUBCã®çŽ°ããªå¶éãããã³ã¢ããã¹ããªãŒã ã«ãŒãã«ã§ã¯å©çšã§ããªãè¿œå ã®ãã§ãã¯ã®ããïŒã
- å®å®ãã䜿çšã®ããã«ïŒããããæ¬çªç°å¢ã«ã€ããŠã¯è©±ãããŠããŸããïŒïŒLinuxã¢ããã¹ããªãŒã ã³ã³ãããŒã¯ãçŽ3.8ïŒçæ³çã«ã¯3.10ïŒã®ã«ãŒãã«ããéå§ã§ããŸãããã«ãŒãã«ã®å€ãã®å®å®ãããã£ã¹ããªãã¥ãŒã·ã§ã³ã§ã¯ãã«ãŒãã«ã¯ããè¥ãããã¹ãŠã®æ©èœã䜿çšããæ¹æ³ã¯ãããŸããã Linuxã®ã¢ããã¹ããªãŒã ã³ã³ãããæäœããããã®éåžžã«è¯ããªãã·ã§ã³ã¯ã Oracleã®ã«ãŒãã«ã§ã ãããã¯ããŒãžã§ã³3.8ã§ãããã³ã³ãããç£æ¥ã§äœ¿çšã§ããç¶æ
ã«ãããšäž»åŒµããŠããŸãã
- ãã£ã¹ããªãã¥ãŒã¿ãŒã®è£œé å
ããã®ãµããŒãã¯ãããŸãããããšãã°ãæšæºçãªæ¹æ³ã§ã¯ãFedora 20ãã³ã³ãããŒå
ã«é
眮ããããšã¯ã§ããŸããããä»®æ³ãã·ã³ã§ã¯å¯èœã§ãã ã€ã³ã¹ããŒã«ã®è³ªåã«ã¯Debianã®è³ªåãããç°¡åã§ãããdebootstrapããã±ãŒãžã¯å¿
èŠãªãã£ã¹ããªãã¥ãŒã·ã§ã³ãç°¡åã«ã€ã³ã¹ããŒã«ã§ããŸãã OpenVZã®å Žåãéçºè
ãOSã®äºåã«çµã¿ç«ãŠãããã€ã¡ãŒãžã䜿çšããŠåé¡ã解決ããŸãã
- 管çãŠãŒãã£ãªãã£ã®åé¡ã ããã¯éåžžã«éèŠãªãã€ã³ãã§ãããããç§ã®æèŠã§ã¯ãããã«ã€ããŠããã«è©³ããæ€èšããèšäºã®æåŸã«åå¥ã«ãã€ã³ãããããšã«ããŸããã
- ãããã¯ãŒã¯æ¥ç¶é床ãå¶éããããã®çµã¿èŸŒã¿ãœãªã¥ãŒã·ã§ã³ã®æ¬ åŠ-ãã®åé¡ã¯ãLinuxã¢ããã¹ããªãŒã ã³ã³ãããŒãšOpenVZã®äž¡æ¹ã«åœ±é¿ããŸãã ãã¡ãããtcã«åºã¥ããŠç¬èªã®ãœãªã¥ãŒã·ã§ã³ãäœæããããšã¯å¯èœã§ããããã®ãããªäŸ¿å©ãªæ©èœã¯åçŽã«ããã§ãªããã°ãªããŸããã
æšæºã®Linuxã³ã³ããåã«å¯ŸããOpenVZã®å©ç¹
OpenVZãšLinuxã®ã¢ããã¹ããªãŒã ã³ã³ãããŒã¯ãã¢ãŒããã¯ãã£ãšå®è£
ãé¡äŒŒããéåžžã«é¡äŒŒãããã¯ãããžãŒã§ãããå€ãã®éãããããŸãã éãã®äžéšã¯ãçŸåšã®ããŒãžã§ã³ã®OpenVZã2.6.32 RHELã«ãŒãã«ã§ãµããŒããããŠãããšããäºå®ã«ãããã®ã§ãã ãããŠïŒ ç§ãšåãããã«èŠããŸããïŒ 2.6.32ã³ã¢ã§ããïŒ ãã ãããã®ã«ãŒãã«ãå€ãããšãæããªãã§ãã ãããRedHatã¯æ°ãããã©ã³ãããã³ãŒããããã¯ããŒãããããã«å€å€§ãªäœæ¥ãè¡ã£ãŠããããã®ã«ãŒãã«ã¯æ©èœçã«3.xã«éåžžã«è¿ããåæã«æšæºãããã©ã2.6ããéåžžã«é ãããã§ãã 32ã
ãããã£ãŠãRHEL6 OpenVZã³ã¢ãšçŸåšã®ããŒãžã§ã³ã®ã¢ããã¹ããªãŒã ã«ãŒãã«ïŒ3.12ïŒãæ¯èŒãããšã ããã»ããµãšãã£ã¹ã¯ãªãœãŒã¹ã®åé¢ã¬ãã«ã¯åãã¬ãã«ã§ããã以äžã«æ³šæãã䟡å€ã®ãã埮åŠãªç¹ãããã€ããããŸãã
äžæµã®Linuxã«ãŒãã«ã«ã¯ãªãOpenVZã«ã¯æ£ç¢ºã«äœããããŸããïŒ
- vSwapã·ã¹ãã ã䜿çšãããŸããããã«ãããã³ã³ãããŒã®ãªãŒããŒã³ããããæ§æã§ããä»®æ³ïŒä»®æ³çã«ïŒçŽ100ã¡ã¬ãã€ã/ç§ã®é床ã§ïŒã¹ããŒããŠã³ããããïŒSWAPãçºè¡ããããšãã§ããŸãã
- ãã现ããUBCã«ãŠã³ã¿ãŒã«ãããã³ã³ãããæ¶è²»ããRAMãããæ£ç¢ºã«èšç®ãã䜿çšäžã®ã«ãŒãã«ã¡ã¢ãªããœã±ããã¡ã¢ãªãå²ãåœãŠæžã¿ããã³å®éã«äœ¿çšäžã®ã¡ã¢ãªãããŒãžæ°shmã¡ã¢ãªãªã©ãèšç®ã§ããŸãã
- åã³ã³ããã«ããããŒãžãã£ãã·ã¥ã®æ¶è²»ãèæ
®ããæ©èœ
- LVMã«é¡äŒŒããæ©èœãåããploopã«åºã¥ããŠæ§ç¯ãããã䜿çšå¯èœãªã³ã³ããã¹ããŒã¹ãå¶éããæ©èœãã¹ãããã·ã§ãããäœæããæ©èœããªã³ã©ã€ã³ã¢ãŒãã§å¢æžããæ©èœãåããã¹ãã¬ãŒãžã·ã¹ãã ã ãã®ãã¡ã€ã«ã·ã¹ãã ã¯ãå®å
šãªä»®æ³åã·ã¹ãã ã®ã¬ãã«ã§åé¢ã¬ãã«ãæäŸããŸãã
- ããŠã³ã¿ã€ã ããŒãïŒ1 pingã®æ倱ïŒã§ãµãŒããŒãããµãŒããŒãžã®ã©ã€ããã€ã°ã¬ãŒã·ã§ã³ã®ãµããŒããšãéåžžã«å¹ççãªã¢ã«ãŽãªãºã ã®äœ¿çš
ã芧ã®ãšãããOpenVZã®ã»ãŒãã¹ãŠã®å©ç¹ã¯ããœãªã¥ãŒã·ã§ã³ã®å®éã®éçšã«çŠç¹ãåœãŠãŠãããLinuxã®ã¢ããã¹ããªãŒã ã³ã³ãããŒã®ããã«ããã®æ©äŒãŸãã¯ãã®æ©äŒãå®è£
ããã¡ã«ããºã ãæäŸããããšã«çŠç¹ãåœãŠãŠããŸããã
ãŠãŒã¶ãŒç©ºéããã®åé¡
æ®å¿µãªãããã³ã³ããã管çããçµ±äžãããæ¹æ³ã¯ãããŸããã OpenVZã¯ããã«vzctlã䜿çšããŸããããã¯ãããŒãžã§ã³3.x以éã®éåžžã®
ã¢ããã¹ããªãŒã ã«ãŒãã«ã§ãã³ã³ãããŒã管çã§ããŸãããŸããFedora-20ããã±ãŒãžã«å«ãŸããŠãããå€éšã®äŸåé¢ä¿ãªãã§ã€ã³ã¹ããŒã«ããã³äœ¿çšã§ããŸãã LXCããã³dockerïŒLXCã«ãåºã¥ããŠããŸãïŒããããŸãããã³ã³ãããŒãŠãŒã¶ãŒãå¿
èŠãšããå¯èœæ§ã®ãããã¹ãŠã®æ©èœãå®å
šã«ã¯ã«ããŒããŠããŸããã ããã«ãLinux Upstream Containersã¯éåžžã«éæšæºçãªå Žæã§äœ¿çšãããŠã
ãŸã ãå€ãã®ãã£ã¹ããªãã¥ãŒã·ã§ã³ã§äœ¿çšãããŠããsystemdåæåã·ã¹ãã ã§ãã
systemd-nspawæ©èœã§ãã
ãããã£ãŠãLinuxã§ã³ã³ãããŒã管çããããã®äŸ¿å©ã§ãæèœã§ãæè»æ§ããããé©åã«èšèšããããã¬ãŒã ã¯ãŒã¯ãå®è£
ããåé¡ã¯éãããŠããããããæžãããšã§äžçãå€ããããšãã§ããŸãïŒç¬ïŒ 2013幎ã
çµè«
ãããŸã§èŠãŠããããã«ãLinuxã§ã®ã³ã³ãããŒåã¯éåžžã«æŽ»çºã«éçºãããŠãããä»åŸæ°å¹Žéã§ãã¢ããã¹ããªãŒã ã«ãŒãã«ã§ã®æ¬æ Œçãªã³ã³ãããŒåã®æºåãæŽããŸãã ãã ããç£æ¥çšã®å ŽåïŒããã§ã¯ãã¯ã©ã€ã¢ã³ãã䜿çšããŠçžäºã«åé¢ããç¬èªã®ãµãŒãã¹ã§ã¯ãããŸããïŒãã³ã³ããã¯OpenVZã䜿çšããå Žåã«ã®ã¿æºåã§ããŸãã ãã ããç¬èªã®ç®çã§ã³ã³ããåãå¿
èŠãªå Žåã¯ãLinuxã¢ããã¹ããªãŒã ã³ã³ãããæé©ãªéžæè¢ã§ããã«ãŒãã«ã®çŸåšã®ããŒãžã§ã³ãå¿é
ããã ãã§ãã
ãŸããç¹ã«è€éãªæè¡çåé¡ã®ç·šéã«ååããŠãããAndrey Wagin
avaginã«ãæè¬ããŸãã
æ¬å
·ããã«ã»ãªãã£ã³ãã©ã
CTO
FastVPS LLC