ããã«ã¡ã¯ãæè¡4課ã®ä¼è¤Kã§ãã ã¿ã¤ãã«ã®æ«å°¾ã¯ã3ãããé£æ³ãããã¬ã¼ãºãªã®ã§æ·±ãæå³ã¯ããã¾ããã
ä»åã¯ã2å°ã®EC2ã¤ã³ã¹ã¿ã³ã¹éã§SQL Server AlwaysOnãæ§æãããã®ç¬¬3åããAlwaysOnè¨å®ç·¨ãã§ãã ããããæçµåãAlwaysOnã®è¨å®ã§ãã ååããéãããã¦ãã¾ããå ¨å½ã®SQL Server on EC2ãã¡ã³ã«ã¯ç³ã訳ãªãæãã¾ãã
ï¼å ¨3åãªã³ã¯ï¼ 1. OSæºåç·¨ 2. WSFCè¨å®ç·¨ 3. AlwaysOnè¨å®ç·¨ (ãã®è¨äº)
ä½æ¥åã®ç¶æ ãåæ
ã2. WSFCè¨å®ç·¨ãã®æé ãå®äºããç¶æ ãåæã¨ãã¾ãã ä½æ¥ã¯ãAWS Delegated Administratorsãã°ã«ã¼ãã«æå±ãããã¦ã¼ã¶ã¼ã¢ã«ã¦ã³ãã§å®æ½ãã¾ãã
ãã¼ã¸ã§ã³ã¨ãã£ã·ã§ã³ãIPã¢ãã¬ã¹çã®æ å ±ãåæ²ãã¾ãã
OS | Windows Server 2012 R2 Standard Edition |
SQL Server | SQL Server 2014 Enterprise Edition SP2 (12.0.5000.0) |
å 容 | ã³ã³ãã¥ã¼ã¿ã¼å / ãªã½ã¼ã¹å / ãªã¹ãã¼å |
IPã¢ãã¬ã¹ |
AlwaysOn ã¤ã³ã¹ã¿ã³ã¹ #1 ï¼æä¸ã1å·æ©ãã¨è¨ãã¾ãï¼ |
sql01 | 172.20.10.4 |
AlwaysOn ã¤ã³ã¹ã¿ã³ã¹ #2 ï¼æä¸ã2å·æ©ãã¨è¨ãã¾ãï¼ |
sql02 | 172.20.11.4 |
ã¯ã©ã¹ã¿ã¼ã³ã¢ãªã½ã¼ã¹ | t-cluster | 172.20.10.5 / 172.20.11.5 |
AlwaysOn ãªã¹ãã¼ | t-aonlis01 | 172.20.10.6 / 172.20.11.6 |
ãµã¼ãã¹ã®è¨å®å¤æ´
1å·æ©ã§Windowsã®ã¹ã¿ã¼ãã¡ãã¥ã¼ãããSQL Server 2014 Configuration Managerããéãã¾ãã
ãSQL Server ãµã¼ãã¹ããéãããSQL Server ã¤ã³ã¹ã¿ã³ã¹åãã®ã¢ã¤ã³ã³ãå³ã¯ãªãã¯ãããããããã£ããé¸æãã¾ãã
ããã°ãªã³ãã¿ãã§ãµã¼ãã¹ãèµ·åããã¦ã¼ã¶ã¼ã¢ã«ã¦ã³ãï¼ä»¥ä¸ããµã¼ãã¹ã¦ã¼ã¶ã¼ã¢ã«ã¦ã³ããã¨è¨ãã¾ãï¼ããã¡ã¤ã³ã¢ã«ã¦ã³ãã«å¤æ´ãã¾ããï¼ãã®ã¢ã«ã¦ã³ãã¯1å·æ©ã2å·æ©ã§å ±éã®ãã®ã使ç¨ãã¾ããï¼ããã§ã¯ãç¾å¨ãã°ãªã³ãã¦ãããAWS Delegated Administratorsãã°ã«ã¼ãã®ã¦ã¼ã¶ã¼ã¢ã«ã¦ã³ãã使ç¨ãã¾ãã
ãAlwaysOn High Availabilityãã¿ãã§ãEnable AlwaysOn Availability Groupsãã«ãã§ãã¯ãå ¥ãã¾ãã[OK]ãã¿ã³ãã¯ãªãã¯ãã¦ããããã£ãéãã¾ãã
確èªã®ãã¤ã¢ãã°ã表示ãããã®ã§[OK]ãã¿ã³ãã¯ãªãã¯ãã¾ãã
確èªã®ãã¤ã¢ãã°ã«å¾ãããSQL Server ã¤ã³ã¹ã¿ã³ã¹åãã®ã¢ã¤ã³ã³ãå³ã¯ãªãã¯ãã¦ãåèµ·åã(Restart)ãé¸æãããã¨ã§ãµã¼ãã¹ãåèµ·åããã¾ãã
2å·æ©ã§ãWindowsã®ã¹ã¿ã¼ãã¡ãã¥ã¼ãããSQL Server 2014 Configuration Managerããéããåä¸ã®æé ãå®æ½ãã¾ãã
ãã©ã«ãæºå
åãµã¼ãã¼ï¼ã¤ã³ã¹ã¿ã³ã¹ï¼ã«ãã¼ã¿ãã¼ã¹ãã¡ã¤ã«ãæ ¼ç´ãããã©ã«ããä½æãã¾ãã1å·æ©ã2å·æ©ã¨ãåããã¹ã§ããå¿ è¦ãããã¾ãã ããã§ã¯ãC:\SQL_DATAãã¨ãã¾ãã
ä½æãããã©ã«ãã«å¯¾ãã¦ãµã¼ãã¹ã¦ã¼ã¶ã¼ã¢ã«ã¦ã³ãããå¤æ´ãã®æ¨©éãæã¤å¿ è¦ãããã¾ããããã§ã¯ãAWS Delegated Administratorsãã°ã«ã¼ãã®ã¦ã¼ã¶ã¼ã使ã£ã¦ãããããã©ã«ãã§è¦ä»¶ä»¥ä¸ã®æ¨©éãããã®ã§ç¹ã«è¨å®ã¯è¡ãã¾ããã
2å·æ©ã§ããC:\SQL_DATAããä½æãã¾ãã
ããã«ã1å·æ©ã2å·æ©éã§åååæãå®æ½ããããã®ä¸æçãªå ±æãã©ã«ããä½æãã¾ããããã¯1å·æ©ã2å·æ©ããã¢ã¯ã»ã¹ã§ããå ´æã«1ã¤ããã°OKã§ãã ããã§ã¯ã1å·æ©ã«ãwkshareãã¨ãããã©ã«ããä½æãã以ä¸ã®æ¨©éã§å ±æè¨å®ããã¾ãã
å ±æå | wkshare |
å ±æ許å¯è¨å® | Everyone - ãã«ã³ã³ããã¼ã« |
NTFS権éè¨å® | ï¼ããã©ã«ãã®ã¾ã¾ï¼ |
ã ã ã
ãã°ã¤ã³è¿½å
1å·æ©ã§ãä¸åº¦OSããµã¤ã³ã¢ã¦ãããå¾ã«ããã¼ã«ã«ç®¡çè ï¼Administratorï¼ã§ãã°ã¤ã³ããªããã¾ãã
ã¹ã¿ã¼ãã¡ãã¥ã¼ããSQL Server Management Studioãèµ·åãã¾ãã
Windowsèªè¨¼ã§1å·æ©ã¸æ¥ç¶ãã¾ãã
1å·æ©ã®ãã»ãã¥ãªãã£ãâããã°ã¤ã³ããå³ã¯ãªãã¯ãã¦ããæ°ãããã°ã¤ã³ãã¡ãã¥ã¼ãé¸æãã¾ãã
[æ¤ç´¢]ãã¿ã³ãã¯ãªãã¯ãã¾ãã
[å ´æ]ãã¿ã³ãã¯ãªãã¯ããã¨è³æ ¼æ å ±ãæ±ããããã®ã§ããã¡ã¤ã³ã¦ã¼ã¶ã¼ã®ã¢ã«ã¦ã³ãã¨ãã¹ã¯ã¼ããå ¥åãã¾ããããã§ã¯ãµã¼ãã¹ã¦ã¼ã¶ã¼ã¢ã«ã¦ã³ãã使ç¨ãã¾ãã ã
ãã¡ã¤ã³åãé¸æãã¦[OK]ãã¿ã³ãã¯ãªãã¯ãã¾ãã
ãµã¼ãã¹ã¦ã¼ã¶ã¼ã¢ã«ã¦ã³ãåãå ¥åãã¦[ååã®ç¢ºèª]ãã¯ãªãã¯ããã¨ä¸ç·ãä»å¸¯ããã¾ãã[OK]ãã¯ãªãã¯ãã¾ãã
ãµã¼ãã¹ã¦ã¼ã¶ã¼ã¢ã«ã¦ã³ããããã°ã¤ã³åãã«è¿½å ããã¾ãã
ããµã¼ãã¼ãã¼ã«ãã¿ããã¯ãªãã¯ãã¦ãsysadminãã«ãã§ãã¯ãå ¥ãã¦[OK]ãã¯ãªãã¯ãã¾ãã
ããã°ã¤ã³ãä¸è¦§ã«ãµã¼ãã¹ã¦ã¼ã¶ã¼ã¢ã«ã¦ã³ãã追å ããã¾ãã
ç¾å¨ãã¼ã«ã«ã®Administratorã§ãã°ãªã³ãã¦ããã®ã§ãä¸åº¦OSããµã¤ã³ã¢ã¦ãããå¾ã«ããµã¼ãã¹ã¦ã¼ã¶ã¼ã¢ã«ã¦ã³ãã§ãã°ãªã³ãã¾ãã
2å·æ©ãåãæé ã§ãã°ã¤ã³ã追å ãã¾ãã 追å å¾ã¯ãåããä¸åº¦OSããµã¤ã³ã¢ã¦ãããå¾ã«ããµã¼ãã¹ã¦ã¼ã¶ã¼ã¢ã«ã¦ã³ãã§ãã°ãªã³ãã¾ãã
å¯ç¨æ§ã°ã«ã¼ãã®ä½æããã¼ã¿ãã¼ã¹ç»é²
1å·æ©ã§OSã®ã¹ã¿ã¼ãã¡ãã¥ã¼ããSQL Server Management Studioãèµ·åãã¾ãã
Windowsèªè¨¼ã§1å·æ©ã¸æ¥ç¶ãã¾ãã
ãªãã¸ã§ã¯ãã¨ã¯ã¹ããã¼ã©ã¼ã®ãæ¥ç¶ãâããã¼ã¿ãã¼ã¹ã¨ã³ã¸ã³ãã¡ãã¥ã¼ãã2å·æ©ã¸ãæ¥ç¶ãã¾ãã
対象ã¨ãªããã¼ã¿ãã¼ã¹ãä¸åº¦ãå®å ¨å¾©æ§ã¢ãã«ãã®è¨å®ã§ããã¯ã¢ããããå¿ è¦ãããã¾ãã 1å·æ©ã®ããªã¼ãã対象ã®ãã¼ã¿ãã¼ã¹ãå³ã¯ãªãã¯ãããããããã£ããé¸æãã¾ããããã§ã¯ãã¹ãç¨ã«ä½æãããtest_dbãã対象ã¨ãã¾ãã
ããªãã·ã§ã³ããã¼ã¸ãã¯ãªãã¯ãã¦ã復æ§ã¢ãã«ããå®å ¨ãã«å¤æ´ãã¾ãã[OK]ãã¯ãªãã¯ãã¾ãã
å度対象ã®ãã¼ã¿ãã¼ã¹ãå³ã¯ãªãã¯ãã[ã¿ã¹ã¯] - [ããã¯ã¢ãã] ãé¸æãã¾ãã
ããã¯ã¢ããå ã®ãã¹ã¯ä»»æã§æ§ãã¾ãããããã§ã¯ããã©ã«ãã§é²ãã¾ãã[OK]ãã¯ãªãã¯ãã¾ãã
ããã¯ã¢ãããå®äºãã¾ããã
ãAlwaysOn é«å¯ç¨æ§ããå±éãã¦ãå¯ç¨æ§ã°ã«ã¼ãããå³ã¯ãªãã¯ãã¾ãã[æ°ããå¯ç¨æ§ã°ã«ã¼ã ã¦ã£ã¶ã¼ã] ãé¸æãã¾ãã
[次ã¸]ãã¯ãªãã¯ãã¦é²ãã¾ãã
ä»»æã®ã°ã«ã¼ãåãå ¥åãã¦[次ã¸]ãã¯ãªãã¯ãã¾ããããã§ã¯äºå®ã®ãªã¹ãã¼åã¨åä¸ã«ãã¾ãã
å ã»ã©ããã¯ã¢ãããåã£ã対象ã®ãã¼ã¿ãã¼ã¹åã§ãããã¨ã確èªãããã§ãã¯ãå ¥ãã¦[次ã¸]ãã¯ãªãã¯ãã¾ãã
ãã¬ããªã«ãã¿ãã§[ã¬ããªã«ã®è¿½å ] ãã¯ãªãã¯ãã¦ã2å·æ©ã®ãã¹ãåãæå®ãã¦Windowsèªè¨¼ã§æ¥ç¶ãããã¨ã§ã2å·æ©ãä¸è¦§ã«è¿½å ããã¾ãã
ãèªåãã§ã¼ã«ãªã¼ãã¼ããå¯ç¨æ§ã¢ã¼ããçã®é ç®ã¯è¦ä»¶ã«æ²¿ã£ã¦è¨å®ãã¾ããããã§ã¯ä¸å³ã®éãã¨ãã¾ããä»ã®ã¿ããããã©ã«ãã®ã¾ã¾[次ã¸]ãã¯ãªãã¯ãã¾ãã
[å®å ¨ãªãã¼ã¿ãã¼ã¹ã¨ãã°ããã¯ã¢ãã] ãé¸æããå ã»ã©åååæç¨ã«ä½æããå ±æãã©ã«ãã®å ±æãã¹ãå ¥åãã¾ããã¨ã¯ã¹ããã¼ã©ã¼ã§ãã¹ãå ¥åãã¦ãã©ã«ããéãããã¨ã確èªãããã®ãã¹ãã³ãã¼è²¼ãä»ãããã¨ããã¹ãé²ãã¾ãã[次ã¸]ãã¯ãªãã¯ãã¾ãã
è¦ä»¶ã®æ¤è¨¼ãè¡ããã¾ãããè¦åããçºçãã¦ãã¾ããããªã³ã¯ãã¯ãªãã¯ãã¦å 容ã確èªãããå¯ç¨æ§ã°ã«ã¼ããªã¹ãã¼ãã¾ã ä½æãã¦ããªããå 容ã§ããã°å¾ã®æé ã§ä½æããã®ã§åé¡ãªãããããã®ã¾ã¾[次ã¸]ãã¯ãªãã¯ãã¾ãã ã
ãµããªã¼ã表示ãããã®ã§ãä¸éã確èªãã¦[å®äº]ãã¿ã³ãã¯ãªãã¯ãã¾ãã
ã¦ã£ã¶ã¼ããå®è¡ãããå¯ç¨æ§ã°ã«ã¼ããä½æããã¾ãã
ãå¯ç¨æ§ã°ã«ã¼ããã®ããªã¼ãå±éããã¨ããå¯ç¨æ§ã¬ããªã«ãããå¯ç¨æ§ãã¼ã¿ãã¼ã¹ãã追å ããã¦ãã¾ãã
å¯ç¨æ§ã°ã«ã¼ããªã¹ãã¼ã®æ§æ
ãããããå¯ç¨æ§ã°ã«ã¼ããªã¹ãã¼ã®è¿½å ã§ãããå¯ç¨æ§ã°ã«ã¼ããªã¹ãã¼ããå³ã¯ãªãã¯ãã¦ããªã¹ãã¼ã®è¿½å ããé¸æãã¾ãã
ããªã¹ãã¼ã®DNSåãã«äºå®ã®ãªã¹ãã¼åãå ¥åãããã¼ãã¯æ¨æºã®1433ã使ç¨ãã¾ããããããã¯ã¼ã¯ã¢ã¼ããã®é ç®ã¯ãéç IPããé¸æãã¾ããIPã¢ãã¬ã¹ã追å ããããã«[追å ]ãã¿ã³ãã¯ãªãã¯ãã¾ãã
1å·æ©ã®å±ãããµãããããé¸æãã対å¿ããIPã¢ãã¬ã¹ï¼ãªã¹ãã¼ã«å²ãæ¯ãäºå®ã®IPã¢ãã¬ã¹ï¼ãå ¥åãã¦[OK]ãã¯ãªãã¯ãã¾ãã
ä¸è¦§ã«IPã¢ãã¬ã¹ã追å ãããã®ã§ãå度[追å ]ãã¯ãªãã¯ãã¦åãæé ã§2å·æ©ã®å±ãããµãããããIPã¢ãã¬ã¹ã追å ãã¾ãã
[OK]ãã¯ãªãã¯ããã¨ãªã¹ãã¼ã追å ããã¾ãã ã
æ¥ç¶ç¢ºèª
1å·æ©ã2å·æ©ä»¥å¤ï¼DBã®æ¥ç¶å ãµã¼ãã¼çï¼ããæ¥ç¶ç¢ºèªãã§ããã°ãã¹ãã§ãããä»åã¯ãã®ç°å¢ãç¨æãã¦ããªããããåãµã¼ãã¼ã1å°ãã¤ã»ã«ã³ããªã®ç¶æ ã¨ããããããã»ã«ã³ããªããæ¥ç¶ç¢ºèªãå®æ½ãã¾ãã ã¾ãã¯1å·æ©ããã©ã¤ããªã®ç¶æ ã§æ¥ç¶ç¢ºèªãè¡ãã¾ããããã§ã¯sqlcmdãç¨ãã¦æ¥ç¶ç¢ºèªãè¡ãã¾ãã
ç¾å¨ã®ã»ã«ã³ããªã§ããã2å·æ©ããã³ãã³ãã使ã£ã¦ç¢ºèªãã¾ãããã¼ã¿ãã¼ã¹ã«æ¥ç¶ããããã¼ãã«åä¸è¦§ã表示ããã¾ããã
ã¬ã³ã¼ãã®è¿½å ãã§ãã¾ãã
次ã«æåãã§ã¼ã«ãªã¼ãã¼(â»)ãè¡ãã2å·æ©ããã©ã¤ããªã1å·æ©ãã»ã«ã³ããªã®ç¶æ ã§åãæé ã§æ¥ç¶ç¢ºèªãè¡ãã¾ãã
â» æåãã§ã¼ã«ãªã¼ãã¼ã®æé ã«ã¤ãã¦ãã¹ã¯ãªã¼ã³ã·ã§ãããç´å¤±ããä¸ãæ¤è¨¼ç°å¢ãåé¤ãã¦ãã¾ã£ãã®ã§æ¡å ãã§ãã¾ãããç³ã訳ããã¾ããã»ã»ã» 確ããä¸å³ã®å¯ç¨æ§ã°ã«ã¼ãåã®ã¢ã¤ã³ã³ãå³ã¯ãªãã¯ãã¦ããã§ã¼ã«ãªã¼ãã¼ããé¸æãã¦ãã¦ã£ã¶ã¼ãã«æ²¿ã£ã¦æä½ããã°ã§ããã¨æãã¾ãã
以ä¸ã§ãæ¥ç¶ç¢ºèªãå®äºãã¾ããã
ãããã«
é·ãã£ãæ§ç¯æé ãçµãããAlwaysOnä¼èª¬ãå§ã¾ãã¾ãããç²ããã¾ã§ããã