ååã®è¨äº MySQLをmaster:slave=1:1構成にして参照をslaveに向けるのがなぜ良くないか ã®ç¶ãã§ãã
master : slave = 1 : 1 ã§åç §ã slave ã«åæ£ãã¦ãã¾ã£ããç¾å³ãããªãããã§ãããã§ã¯åç §ã®è² è·åæ£ãè¡ãããå ´åã® slave ã¯ä½å°ã§æ§æããã¨ããã®ãèå¯ãã¦ã¿ã¾ããå ·ä½çã«ã¯ slave 2å°ã®å ´å㨠3å°ã®å ´åã§ã©ã¡ãããå¾ãã
å°æ°ãå¢ããã¨ãããã¨ã¯ãã©ããã«é害ãçºçãã確çãé«ã¾ããã¨ãããã¨ã§ãã1å°ã® slave ã«é害ãçºçãã¦ãã¦ã³ããå ´åã®ãã¨ãèãã¦ã¿ã¾ãã
- slave * 2 â æ®ã 1å°ã§å¦çç¶ç¶
- çãæ®ã£ã1å°ãããã®å¦çã 2åã«ãªã
- slave * 3 â æ®ã 2å°ã§å¦çç¶ç¶
- çãæ®ã£ã1å°ãããã®å¦çã 1.5åã«ãªã
ãã¨ãã° 1å°ãããæå¤§ 1000qps ã®å¦çè½åãããã¨ãã¾ããslave 1å°ããã¦ã³ããå ´åã«ãå®å®ãã¦å¦çãç¶ç¶ããããã«ã¯ã平常æã«è¨±å®¹ãããè² è·ã¯ä»¥ä¸ã®ããã«ãªãã¾ãã
- slave * 2 â 500qps * 2 = 1000qps * 1 = åè¨ 1000qps
- slave * 3 â 666qps * 3 = 1000qps * 2 = åè¨ 2000qps
slave å°æ°ã¯ 1.5åã§ããã平常æã«è¨±å®¹ã§ããå¦çè½å㯠2åã«ãªãã®ã§ã3å°æ§æã®ã»ãããå¾ã§ãã
ãã¦ãé害ãçºçãã¦åãé¢ãã slave ã¯å¾©æ§ä½æ¥ãè¡ãå¿ è¦ãããã¾ããslave ãæ§ç¯ããã«ã¯ãã£ããã¨
- mysqldump ã§åå¾ããããã¯ã¢ããããã®ã¬ã¹ãã¢
- æ¢åã®ãã¼ã¿ã丸ãã¨ã³ãã¼
ã®äºã¤ã®ææ®µãããã¨æãã¾ãã
ãã¡ã¤ã«ã³ãã¼ã«æ¯ã¹ã¦ãããã¯ã¢ããããã®ã¬ã¹ãã¢ã¯æéããããã¾ããã¾ããæ¯æ¥1åããã¯ã¢ãããåã£ã¦ããå ´åãã¬ã¹ãã¢æã«ã¯æå¤§24æé(å¹³å12æé) ã®æéå·®ããããããã¬ã¹ãã¢å¾ã«ãã®æéåã®æ´æ°ã追ãã¤ããããã¨ãã使¥ãå¿
è¦ã«ãªãã¾ãã
ãã¡ã¤ã«ã³ãã¼ã§æ¸ãã°ãããã«è¶ãããã¨ã¯ãªãããã§ãã
slave 2å°æ§æã®å ´åãçãæ®ã£ã¦ãã 1å°ããã¡ã¤ã«ã³ãã¼ãè¡ãããã«åæ¢ãããã¨ã¯ãå
¨ä½ã®ãµã¼ãã¹åæ¢ã«ç¹ããã¾ãã(LVM snapshot ãªã©ã使ç¨ããã°åæ¢æéã¯æå°ã«æãããã¨ã¯ã§ãã¾ãã)
slave 3å°æ§æã®å ´åã¯çãæ®ã£ã 2å°ã®ãã¡ 1å°ããè² è·ã®ä½ãæé帯ã«åæ¢ãã¦ã¾ããã¨ã³ãã¼ãããã¨ãã§ãã¾ãã
ã¤ã¾ã 2å°æ§æããã 3å°æ§æã®ã»ãããslave ã®ä½ãç´ã使¥ãæ ¼æ®µã«æ¥½ã«ãªããã¨ãããã¨ã§ããã
ã¨ãããã¨ã§ãåæã³ã¹ãã¯ä¸ããã¾ããé害æã®ãã¨ãèããã¨ãslave ã§åç §ã忣ãããªã 2å°ããã 3å°æ§æã§ã¯ãããã®ãããã®ã§ã¯ãã¨ããã®ãå人çãªçµè«ã§ãã