

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 使用 遷移 Microsoft SQL Server Always On 可用性群組 AWS Application Migration Service
<a name="migrate-microsoft-sql-server-always-on-group-using-mgn"></a>

*Sreenivas Nettem、Bharath Kumar Pammi Ramesh、Anantharaman Seshadri 和 Gireesh Sreekantan，Amazon Web Services*

## 總結
<a name="migrate-microsoft-sql-server-always-on-group-using-mgn-summary"></a>

AWS Application Migration Service (AWS MGN) 是重新託管 中現有環境的偏好工具 AWS 雲端，可讓客戶遠離內部部署資料中心。此模式概述使用 AWS MGN 透過 Microsoft SQL Server Always On 可用性群組遷移 Windows 叢集的程序。

## 先決條件和限制
<a name="migrate-microsoft-sql-server-always-on-group-using-mgn-prereqs"></a>

**先決條件**
+ 作用中 AWS 帳戶。
+ MGN 協同運作的 AWS AWS Identity and Access Management (IAM) 角色。
+ 存取來源資料庫伺服器 (SQL Server Always On 可用性群組）。
+  AWS 登陸區域中用於保留 DNS 名稱的 Active Directory。
+ 與 Active Directory 進行封閉網路通訊的預備子網路。
+ 可與 Active Directory 通訊的目標子網路。
+ 目標子網路中 Windows 叢集的兩個預留 IP 地址 （每個可用區域一個）。
+ 目標子網路中 SQL Always On 接聽程式的兩個預留 IP 地址 （每個可用區域一個）。

**產品版本**
+ Windows Server 2012 或更新版本
+ SQL Server 2012 或更新版本

## Architecture
<a name="migrate-microsoft-sql-server-always-on-group-using-mgn-architecture"></a>

**來源技術堆疊**

Microsoft Windows 叢集 （內部部署實體或虛擬機器） Microsoft SQL Server Always On 可用性群組

**目標技術堆疊**

Amazon EC2 Windows 執行個體

**目標架構**

![使用 AWS MGN 遷移 SQL Server Always On 可用性的 AWS 架構。](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/images/pattern-img/aa94040b-5ecf-42f9-90e3-929d0fa5e715/images/0b85c613-51df-475b-9598-3da3f9cd47c6.png)


## 工具
<a name="migrate-microsoft-sql-server-always-on-group-using-mgn-tools"></a>

*AWS 服務*
+ [Amazon Elastic Compute Cloud (Amazon EC2)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts.html) 在 AWS 雲端中提供可擴展的運算容量。您可以視需要啟動任意數量的虛擬伺服器，，並快速進行擴展或縮減。
+ [AWS Application Migration Service](https://docs.aws.amazon.com/mgn/latest/ug/what-is-application-migration-service.html) 可協助您將應用程式重新託管 （提升和轉移） 到 ， AWS 雲端 無需變更，且停機時間最短。
+ [AWS Identity and Access Management (IAM)](https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html) 透過控制已驗證並獲授權使用的人員，協助您安全地管理對 AWS 資源的存取。

*其他工具*
+ [Microsoft SQL Server Management Studio (SSMS)](https://learn.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms) 是一種用於管理 SQL Server 的工具，包括存取、設定和管理 SQL Server 元件。

## 最佳實務
<a name="migrate-microsoft-sql-server-always-on-group-using-mgn-best-practices"></a>

對於 AWS MGN，請參閱 [的最佳實務 AWS Application Migration Service](https://docs.aws.amazon.com/mgn/latest/ug/best_practices_mgn.html)。

## 史詩
<a name="migrate-microsoft-sql-server-always-on-group-using-mgn-epics"></a>

### 準備目標帳戶
<a name="prepare-the-target-account"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 初始化 AWS MGN。 | 在目標中初始化 AWS MGN AWS 區域。這會建立所需的 IAM 角色和政策。如需詳細資訊，請參閱[使用 主控台初始化 Application Migration Service](https://docs.aws.amazon.com/mgn/latest/ug/mgn-initialize-console.html)。 | 雲端管理員 | 
| 建立複寫和啟動範本。 | 設定複寫和啟動範本以搭配 AWS MGN 使用。如需詳細資訊，請參閱 AWS 文件中的[設定範本](https://docs.aws.amazon.com/mgn/latest/ug/mgn-initialization-templates.html)。 | 雲端管理員 | 
| 允許通訊連接埠。 | 若要啟用 AWS MGN 的網路通訊，請允許透過 TCP 連接埠 443 和 1500 的流量。如需詳細資訊，請參閱 AWS 文件中的 [Application Migration Service 的網路需求](https://docs.aws.amazon.com/mgn/latest/ug/Network-Requirements.html)。 | 雲端管理員、網路管理員 | 

### 準備來源伺服器
<a name="prepare-the-source-server"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 驗證 AWS MGN 先決條件。 | 確認來源伺服器符合 AWS MGN 代理程式安裝的先決條件。如需詳細資訊，請參閱 AWS 文件中的[安裝需求](https://docs.aws.amazon.com/mgn/latest/ug/installation-requirements.html)。 | 遷移工程師 | 
| 安裝 AWS MGN 代理程式。 | 在來源伺服器上安裝 AWS MGN 代理程式。在安裝期間，選擇將遷移伺服器的 AWS 區域 。安裝後，代理程式會與服務通訊並開始複寫。如需詳細資訊，請參閱[在 Windows 伺服器上安裝複 AWS 寫代理](https://docs.aws.amazon.com/mgn/latest/ug/windows-agent.html)程式。 | 遷移工程師 | 
| 檢查來源伺服器狀態。 | 在 AWS MGN 主控台中，檢查來源伺服器的狀態。伺服器會在複寫開始時顯示**準備進行測試**。<br />如果您遇到任何錯誤，請參閱 AWS MGN 文件中的[疑難排解通訊錯誤](https://docs.aws.amazon.com/mgn/latest/ug/Troubleshooting-Communication-Errors.html)。 | 雲端管理員、遷移工程師 | 
| 最佳化複寫設定。 | SQL Always On 叢集使用從主要伺服器到次要伺服器的高 I/O 同步複寫。若要最佳化複寫並避免延遲，請為每個 SQL Always On [伺服器使用專用的複寫](https://docs.aws.amazon.com/mgn/latest/ug/replication-settings-template.html)伺服器。<br />如果資料庫大於 5 TB，請考慮選擇較大的複寫伺服器執行個體大小，例如 **m5.large**，而非預設的 **t3.small。** | 雲端管理員、遷移工程師 | 
| 更新啟動範本。 | 更新[啟動設定](https://docs.aws.amazon.com/mgn/latest/ug/launch-settings.html)，並選擇 SQL Always On 伺服器的子網路。SQL Always On 叢集伺服器會分散到不同的 ， AWS 可用區域 以獲得高可用性。 | 遷移工程師，遷移負責人 | 
| 更新啟動設定。 | 根據您的大小和效能需求，更新啟動設定中的執行個體類型和每秒輸入/輸出操作 (IOPS)。<br />（選用） 在啟動設定中選擇現有的彈性網路界面。 | 遷移工程師，遷移負責人 | 

### 測試切換
<a name="test-cutover"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 驗證來源伺服器。 | 在 AWS MGN 主控台中，確認來源伺服器狀態為**準備好進行測試**。 | 雲端管理員、遷移工程師 | 
| 啟動測試執行個體。 | [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/migrate-microsoft-sql-server-always-on-group-using-mgn.html) | 雲端管理員、遷移工程師 | 
| 測試連線能力和資料庫完整性。 | 測試測試執行個體的連線和資料庫完整性。然後在 AWS MGN 主控台中將來源伺服器標記為**準備好進行切換**。 | 雲端管理員、遷移工程師 | 

### 預遷移任務
<a name="pre-migration-tasks"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 測試資料庫完整性。 | 這有助於確保在遷移之前，來源沒有資料庫完整性問題。執行 `DBCC CHECKDB` 並指定 `WITH_PHYSICAL_ONLY`。在沒有 的情況下執行此檢查`WITH_PHYSICAL_ONLY`可能會導致來源的效能問題。若要維護資料庫完整性，請每週對資料庫執行完整檢查。<br />這些命令會偵測潛在的損毀問題，以檢查資料庫的邏輯和實體完整性。檢查會驗證資料庫的結構，例如頁面、資料列、索引和系統資料表。 | 資料工程師，DBA | 
| 測試與連結伺服器的連線。 | 測試所有現有伺服器之間的連線，並記錄其狀態。這有助於確保連結的伺服器在遷移後可如預期運作。 | 資料工程師，DBA | 
| 驗證備份。 | 確認來源備份的完整性。 | 資料工程師，DBA | 

### AWS MGN 切換
<a name="aws-mgn-cutover"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 停止 SQL Server 和叢集服務。 | 停止所有 SQL 叢集節點上的 SQL Server 和 Microsoft 叢集服務。 | DBA，遷移工程師 | 
| 驗證伺服器。 | 在 AWS MGN 主控台中，確認來源伺服器的狀態已**就緒可供切換**，且資料複寫狀態為**良好**。 | 遷移工程師 | 
| 啟動切換。 | [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/migrate-microsoft-sql-server-always-on-group-using-mgn.html)如需詳細資訊，請參閱 AWS MGN 文件中的[啟動切換執行個體](https://docs.aws.amazon.com/mgn/latest/ug/launch-cutover-gs.html)。 | 遷移工程師 | 
| 測試啟動的伺服器。 | 登入已啟動的 Amazon EC2 執行個體，並驗證叢集的運作狀態。確認伺服器位於正確的子網路中、執行個體大小和 IOPS 設定正確，而且可以存取見證伺服器。 | DBA，遷移工程師 | 

### 資料庫切換後任務
<a name="database-post-cutover-tasks"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 更新叢集 IP 地址。 | 使用目標子網路中的兩個預留 IP 地址更新 Windows 叢集的叢集 IP 地址。如需詳細資訊，請參閱[變更容錯移轉叢集執行個體的 IP 地址](https://learn.microsoft.com/en-us/sql/sql-server/failover-clusters/windows/change-the-ip-address-of-a-failover-cluster-instance?view=sql-server-2016)。 | DBA，遷移工程師 | 
| 更新 Always On 可用性群組接聽程式 IPs。 | [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/migrate-microsoft-sql-server-always-on-group-using-mgn.html) | DBA，遷移工程師 | 
| 驗證連線。 | 使用 SSMS，連線至 Always On 可用性群組接聽程式，並確認連線成功。 | DBA，遷移工程師 | 
| 檢查 Always On 可用性群組的運作狀態。 | [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/migrate-microsoft-sql-server-always-on-group-using-mgn.html) | DBA，遷移工程師 | 
| 檢查錯誤日誌。 | 開啟錯誤日誌，並驗證針對 SQL Server 執行個體報告的任何錯誤。確保所有資料庫的復原都已完成。 | DBA，遷移工程師 | 
| 測試連結的伺服器。 | 測試任何連結伺服器的連線能力。如果發生任何連線問題，請確定可存取目標伺服器和連接埠。 | DBA，遷移工程師 | 

### 完成切換
<a name="finalize-the-cutover"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 完成切換。 | 驗證目標 SQL Always On 叢集之後，請透過 AWS MGN 主控台[完成](https://docs.aws.amazon.com/mgn/latest/ug/launch-cutover-gs.html#revert-finalize-cutover-gs)切換。這會停止來源伺服器的資料複寫，並捨棄複寫伺服器的資料。它也會移除複寫伺服器及其相關聯的資源。 | 雲端管理員、遷移工程師 | 

## 疑難排解
<a name="migrate-microsoft-sql-server-always-on-group-using-mgn-troubleshooting"></a>


| 問題 | 解決方案 | 
| --- | --- | 
| AWS MGN 疑難排解 | 如需常見問題和解決方案，請參閱 AWS MGN 文件中的[故障診斷](https://docs.aws.amazon.com/mgn/latest/ug/troubleshooting.html)和[常見問答集](https://docs.aws.amazon.com/mgn/latest/ug/FAQ.html)一節。 | 

## 相關資源
<a name="migrate-microsoft-sql-server-always-on-group-using-mgn-resources"></a>

*AWS resources*
+ [Option-1 Rehost - AWS Application Migration Service (AWS)](https://catalog.us-east-1.prod.workshops.aws/workshops/c6bdf8dc-d2b2-4dbd-b673-90836e954745/en-US/04-application-migration/01-mgn)
+ [什麼是 AWS Application Migration Service？](https://docs.aws.amazon.com/mgn/latest/ug/what-is-application-migration-service.html)

*SQL Server 資源*
+ [什麼是 SQL Server Management Studio (SSMS)？](https://learn.microsoft.com/en-us/ssms/sql-server-management-studio-ssms)

## 其他資訊
<a name="migrate-microsoft-sql-server-always-on-group-using-mgn-additional"></a>

如需將工作負載遷移至 的標準安全需求 AWS 雲端，請參閱 AWS 網站上的[安全、身分和合規最佳實務](https://aws.amazon.com/architecture/security-identity-compliance/)。