MySQL ã®è² è·åæ£ã« LVS + keepalived ã使ã
ãã¨ã§æ¸ããã¨è¨ã£ãæåãªã®ã§æ¸ãã¨ãã¾ãã
DSASã®ä¸ã®äººããããå¢ã㧠LVS ã®è©±ãæ¸ãã¦ããã¦ã¾ãããã®è¾ºãLVS ã使ã㨠Linux ã¨ç®±ã§ãã¼ããã©ã³ãµãä½ãã¡ããã¾ããæ®éã«è²·ã£ããæ°ç¾ä¸ã¨ããã¡ãããã¤ã
DSAS ã®ä¸ã®ã²ã¨ã«æè¬ãã¤ã¤ãããæ©ä¼ãªã®ã§ãã£ã¦ã¿ãã! ã¨æã£ã¦ãããã試ãã¦æ¨æ¥ãããããã¯ã¦ãªã®ä¸ã§ã LVS + keepalived ã§åããã¯ããã¦ã¾ãããã¾ã®ã¨ããåé¡ãªãã
ãã®ãã¼ããã©ã³ãµãã©ãã«ä½¿ã£ã¦ããã§ãããæ®éãã¼ããã©ã³ãµã¨ããã¨ã¤ã³ã¿ã¼ãããããã®å ¥ãå£ã®ã¨ããã«ç½®ãã¦ã¦ã§ããµã¼ãã¼ã®è² è·åæ£ã«ä½¿ãã¤ã¡ã¼ã¸ãããã¾ããããä»åã¯ã¯ã¦ãªã§ã¯ MySQL ã®ã¹ã¬ã¼ãã®æåã«ç½®ãã¨ããå½¹å²ã§ã¨ãããã使ãã¯ããã¾ããã
+-----------+ +-----------+ | mod_perl | | mod_perl | +-----------+ +-----------+ | | +---------------+ | +-----------+ | LVS | +-----------+ | +---------------+ | | +-----------+ +-----------+ |MySQL slave| |MySQL slave| +-----------+ +-----------+ | | +---------------+ | +-----------+ | master | +-----------+
ããããæãã§ãããã®çµµã 㨠NAT ã¿ããã«è¦ãã¾ããå®éã«ã¯ DSR ã§ãã£ã¦ã¾ãã
MySQL ãã¬ããªã±ã¼ã·ã§ã³ããã¦ä½ã£ãã¹ã¬ã¼ããµã¼ãã¼ãè¤æ°ä½ã£ã¦è² è·åæ£ããå ´åãã¦ã§ãã¢ããªã±ã¼ã·ã§ã³ãããã®è¤æ°ã®ã¹ã¬ã¼ãã«ç¹ãã¨ãã«ã©ã³ãã ã«æ¯ã£ã¦ããã¨ãããããã§ãããããã« LVS ãæãã§ã¿ãã¨ãããã®ã
ãã¨ã㨠Flickr ã®ã·ã¹ãã ãã¿ã¦ãMySQL ã®æåã«ãã¼ããã©ã³ãµãæãã§ä½¿ãã¨ããã®ãç¥ã£ããã§ãããããã LVS ã§ãã£ã¦ã¿ã¾ããã(Flickr ã§ã¯ BIGIP ãä½ãã®ç®±ã¢ãã使ã£ã¦ããæ°ããã¾ãã)
LB ãæãå©ç¹ã¯ä»¥ä¸ã®3ã¤ã§ããããã
ã¨ã«ããä¸çªã®å©ç¹ã¯ãã¢ããªã±ã¼ã·ã§ã³ããè¦ãå ´åã«ã¹ã¬ã¼ããã¼ã«ã LB ã«ãã£ã¦æ½è±¡åããããã¨ãä½å°ãããã¹ã¬ã¼ããä¸å°ã®ãã·ã³ã«è¦ãããã¦ä½¿ããã¨ãã§ãã管çãé常ã«æ¥½ã«ãªãã¾ããããã¾ã§ Perl ã®ã³ã¼ãã§æ¯ãåããã¦ãã¨ãã¯ãã¢ããªã±ã¼ã·ã§ã³ã DB ã® IP ã¢ãã¬ã¹ãç¥ã£ã¦ããå¿ è¦ããã£ãã®ã§ã¹ã¬ã¼ãã«ãã·ã³ã追å ããå ´åã¢ããªã±ã¼ã·ã§ã³ã®ã¡ã³ããå¿ è¦ã§ãããããããLB ãããã¨ã¢ããªã±ã¼ã·ã§ã³ã®å´ãæ°ã«ãããã¹ã¬ã¼ããããã·ã³ãã¯ããããã追å ãããã§ãããã¢ããªã±ã¼ã·ã§ã³ã¯ LB ã® IP (VIP) ãç¥ã£ã¦ããã°ããã ãã«ãªãã¾ãã
äºã¤ç®ããããããªã大ãããã§ãã keepalived ã§ãã«ã¹ãã§ãã¯ãã§ããããã«ãªãã¾ãããPerl å´ã§ãã«ã¹ãã§ãã¯ãããã¨ããã¨è²ã èãããã¨ããã£ã¦å¤§å¤ãªã®ã§ãããkeepalived ã«ä»»ãã¦ãã¾ãã°ãã®è¾ºãã¢ããªã±ã¼ã·ã§ã³ã§é¢åè¦ãå¿ è¦ããªããªãããã°ããããããã§ã¹ã¬ã¼ããçªç¶è½ã¡ãããã¦ããµã¼ãã¹ãåé¡ãªãç¶ç¶ã§ãã¾ãã
ä¸ã¤ç®ããã©ã³ã·ã³ã°ã®ã¢ã«ã´ãªãºã ãæ¹åããããPerl ã§ãããã¨ããã¨ãã¤ãªãã«ãã MySQL ã®ã³ãã¯ã·ã§ã³ã®æ°ãè² è·ç¶æ³ããã§ãã¯ããã®ã¯å¤§å¤ã§ãã LVS ã§ããã°ãã®è¾ºããããªã«ãã£ã¦ããã¾ãããªã®ã§ãããåçã«æ¥ç¶ãåæ£ã§ãããä»ã¯ã³ãã¯ã·ã§ã³æ°ãä¸çªãããªãã¨ãããåªå çã«å²ãæ¯ãã¢ã«ã´ãªãºã ãæ¡ç¨ãã¦ã¾ãã
ä»ã®ã¨ãã keepalived 㧠TCP æ¥ç¶ããã§ãã¯ãããã¨ãããã¦ã¾ããããèªåã§ä½ã£ãã¹ã¯ãªããã§ã®ãã§ãã¯ãå¯è½ãªã®ã§ SQL ã®ã¬ãã«ã§æ¥ç¶å¯è½ããªã©ããã§ãã¯ãã¦ããããã«ããã°èé害æ§ãåä¸ããã§ããããLVS ã®ãµã¼ãã¯ä¸å¿ãã£ã¹ã¯ã¬ã¹ã«ãã¦ããã®ã§æ é確çã¯ä½ããã®ã®ä½ããããããããªãã VRRP ã§åé·åãããã®ããã¾è©¦ãã¦ã¾ãã
主ãªã¨ããã¯ãã®ä¸ã¤ããªã¨æãã¾ããèé害æ§ãé«ã¾ããã¡ã³ããã³ã¹ã®æéãæ¸ããå°å ¥ãã¦ããã£ãããªããä»ã®ã¨ããã¯ã¦ãªããã¯ãã¼ã¯ã®ããã¯ã¨ã³ãã¨ãã¤ã¢ãªã¼ã®ä¸é¨ã§ä½¿ã£ã¦ã¾ãã LVS ã®è² è·ã¯ã»ã¼ãªãã«çããã§ãã
ãã«ã¹ãã§ãã¯ãVRRPãªæ©è½ãæè¼ããã¦ã¦ä¸ã¤ DSR ã«å¯¾å¿ãããã¼ããã©ã³ãµã¨ããã¨é«ä¾¡ãªã¤ã¡ã¼ã¸ããã£ã¦ãMySQL ã®ãã©ã³ã·ã³ã°ã«ä½¿ãã£ã¦ã®ã¯ã¡ãã£ã¨é£ãããªã¼ã¨ããæ°ããã¾ãã LVS ãªãç®±(ã¨äººä»¶è²»)ã®ã³ã¹ãã ãã§ãããã§ãã¡ãããOracle ã ã¨é«ããã© MySQL ãªãã³ã¹ãããããªãããã¹ãã¬ã¼ã¸ä»£ããã«æ°è»½ã«ä½¿ã£ã¡ãã ã¨ããã®ã¨ä¼¼ã¦ã¾ããã
ãããããã§ãã LVS ãã£ã¦ã¿ã£ãã¼ã¨è¨ã£ã¦ã
- ã試é¨ç°å¢å¿ è¦ãããªãï¼ãããã·ã³ä½ããã
- ããã£ã¹ã¯ã¬ã¹ã®ãã·ã³å¿ è¦ãããªã?ããããã¯ã§ãã¼ãè²·ã£ã¦ãããã
- ããã¬ã¼ã ã¯ã¼ã¯ã«ã¡ãã£ã¨æãããªãããããªããªã?ãããããæ¸ããã
ã¨ããã®ããããã®å¼å¸ã§ã§ããèªåã¨ãã®ãã¼ã ã¯ãã°ãããã¨æã£ãã
ãããã¯ã¼ã¯è»½ããªãã¨ãã®æã®ãå°å ¥ããã®ã¯ãªããªãé£ããã§ããããããããããªããããããã§ã¦ãã¦ãè² è·ã¯å¤§ä¸å¤«ãªã®ã? å®ç¸¾ã¯ã©ããªãã ãã¨ããããªã®ãã£ã¦ã¿ãªãããããã¾ããããã¨ããã
ããããã ã¤ãã§ã ããæ¸ãã¦ãããããã®æã®ã¿ã¹ã¯ããããå¢ãã§ãã£ã¦ããã¡ãã£ããããæè¡è ã絶è³å¤§åéãã¦ã¾ãããã®è¾ºããã¾ä¸çªæãå¿ è¦ã¨ãã¦ã層ã ã£ãããã¾ãã
ãããã
- ä½è : ãã¼ã¸ã¼ããã
- åºç社/ã¡ã¼ã«ã¼: ç§åã·ã¹ãã
- çºå£²æ¥: 2005/11/29
- ã¡ãã£ã¢: åè¡æ¬
- è³¼å ¥: 4人 ã¯ãªãã¯: 188å
- ãã®ååãå«ãããã° (32件) ãè¦ã
ãã®æ¬ã« LVS ã¨ã keepalived ã®è©±ã How To 交ãã¦ããããè¼ã£ã¦ã¾ããä»ã«ã High Availability ã«é¢ãã話ãããããã
ã§ã¯ãã¢ãµãã·ããã¨ããã§ç· ããããã¨ãã¾ãã