

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

# 在 上將關聯式資料庫遷移至 MongoDB Atlas AWS
<a name="migrate-relational-database-to-mongodb-atlas"></a>

*Battulga Purevragchaa 和 Igor Alekseev，Amazon Web Services*

*Babu Srinivasan，MongoDB*

## 摘要
<a name="migrate-relational-database-to-mongodb-atlas-summary"></a>

此模式說明從關聯式資料庫遷移到 中 MongoDB Atlas 的步驟，例如 SQL Server、MySQL 或 PostgreSQL AWS 雲端。它使用 [MongoDB Relational Migrator](https://www.mongodb.com/products/relational-migrator) 協助加速從關聯式資料庫到 MongoDB Atlas 的資料遷移。

模式隨附於 AWS 上的[遷移至 MongoDB Atlas AWS](https://docs.aws.amazon.com/prescriptive-guidance/latest/migration-mongodb-atlas/) 指南指南網站上的指南。它提供該指南中討論的其中一個遷移案例的實作步驟。如需其他遷移案例，請參閱 AWS 規範指引網站上的下列模式：
+ [在 上將自我託管的 MongoDB 環境遷移至 MongoDB Atlas AWS](https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/migrate-a-self-hosted-mongodb-environment-to-mongodb-atlas-on-the-aws-cloud.html)
+ [在 上將資料從 IBM Db2、SAP、Sybase 和其他資料庫串流至 MongoDB Atlas AWS](https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/stream-data-from-ibm-db2-to-mongodb-atlas.html)

此模式 適用於 [AWS System Integrator (SI) 合作夥伴](https://aws.amazon.com/managed-services/partners/)和 AWS 使用者。

## 先決條件和限制
<a name="migrate-relational-database-to-mongodb-atlas-prereqs"></a>

**先決條件**
+ 要遷移至 MongoDB Atlas 的來源關聯式資料庫 (Oracle Database、SQL Server、PostgreSQL、MySQL、SAP/Sybase ASE 等）。
+ 熟悉關聯式資料庫、MongoDB Atlas 和 AWS 服務。此模式說明一些高層級的遷移步驟。其他詳細資訊將在未來的版本中新增。

**產品版本**
+ MongoDB 5.0 版或更新版本

## Architecture
<a name="migrate-relational-database-to-mongodb-atlas-architecture"></a>

下圖顯示從關聯式資料庫管理系統 (RDBMS) 資料庫遷移至 MongoDB Atlas 的作業 AWS。

![\[從 RDBMS 遷移到 AWS 上 MongoDB Atlas 的架構。\]](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/images/pattern-img/4e3ea0f1-21e8-4641-a9ee-732355f20baf/images/8eacf3ec-f480-4912-9002-6a50800fe9bf.png)


如需支援不同使用案例的 MongoDB Atlas 參考架構，請參閱 AWS Prescriptive Guidance 網站上的[遷移至 上的 MongoDB Atlas AWS](https://docs.aws.amazon.com/prescriptive-guidance/latest/migration-mongodb-atlas/architecture.html)。

## 工具
<a name="migrate-relational-database-to-mongodb-atlas-tools"></a>
+ [MongoDB Atlas](https://www.mongodb.com/atlas) 是全受管資料庫即服務 (DBaaS)，用於在雲端中部署和管理 MongoDB 資料庫。
+ [MongoDB Relational Migrator](https://www.mongodb.com/products/relational-migrator) 可將資料從傳統關聯式資料庫順暢地轉換為 MongoDB。它有助於自動化轉換程序，並將關聯式資料庫的結構化資料模型轉換為 MongoDB 提供的彈性文件格式。Relational Migrator 會保留資料完整性和關係，以簡化遷移。組織可以利用 MongoDB 提供的可擴展性、效能和多樣性優勢，同時保持現有資料的熟悉度。

## 最佳實務
<a name="migrate-relational-database-to-mongodb-atlas-best-practices"></a>

如需在 上使用 MongoDB 的最佳實務 AWS，請參閱 [AWS 合作夥伴網路部落格](https://aws.amazon.com/blogs/apn/tag/mongodb-atlas/)上的文章。

## 史詩
<a name="migrate-relational-database-to-mongodb-atlas-epics"></a>

### 探索和評估
<a name="discovery-and-assessment"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 決定關聯式資料庫的參數和大小。 | 使用關聯式 Migrator 建議和來自 的資訊來估計工作集大小，`db.stats()`以取得總索引空間。假設經常存取您資料空間的百分比。此任務大約需要一週的時間。如需此範例和其他案例的詳細資訊和範例，請參閱[相關資源](#migrate-relational-database-to-mongodb-atlas-resources)一節。 | 應用程式擁有者，DBA | 
| 估計網路頻寬需求。 | 若要估算您的網路頻寬需求，請將平均文件大小乘以每秒提供的文件數量。請考慮叢集上任何節點所承擔的最大流量。若要計算從叢集到用戶端應用程式的下游資料傳輸率，請使用一段時間內傳回文件總數的總和。如果您的應用程式從次要節點讀取，請將總文件數除以可提供讀取操作的節點數。若要尋找資料庫的平均文件大小，請使用 `db.stats().avgObjSize`命令。此任務通常需要一天的時間。 | DBA | 
| 選取 Atlas 層。 | 遵循 [MongoDB 文件](https://www.mongodb.com/docs/atlas/sizing-tier-selection/)中的指示，選取正確的 Atlas 叢集層。 | DBA | 
| 規劃切換。 | 規劃應用程式切換。 | DBA、應用程式擁有者 | 

### 在 上設定新的 MongoDB Atlas 環境 AWS
<a name="set-up-a-new-mongodb-atlas-environment-on-aws"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 在 上建立新的 MongoDB Atlas 叢集 AWS。 | 在 MongoDB Atlas 中，選擇**建置叢集**。在**建立新叢集**對話方塊中，選取 AWS 做為雲端供應商。 | DBA | 
| 選取 AWS 區域 和 全域叢集組態。 | 從 AWS 區域 Atlas 叢集可用的 清單中選取 。視需要設定全域叢集。 | DBA | 
| 選取叢集層。 | 選取您偏好的叢集層。您的方案選擇會決定記憶體、儲存體和 IOPS 規格等因素。 | DBA | 
| 設定其他叢集設定。 | 設定其他叢集設定，例如 MongoDB 版本、備份和加密選項。如需這些選項的詳細資訊，請參閱[相關資源](#migrate-relational-database-to-mongodb-atlas-resources)一節。 | DBA | 

### 設定安全與合規
<a name="configure-security-and-compliance"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 設定存取清單。 | 若要連線至 Atlas 叢集，您必須將項目新增至專案的存取清單。Atlas 使用 TLS/SSL 來加密與資料庫虛擬私有雲端 (VPC) 的連線。若要設定專案的存取清單，以及有關此史詩中故事的詳細資訊，請參閱[相關資源](#migrate-relational-database-to-mongodb-atlas-resources)一節。 | DBA | 
| 驗證和授權使用者。 | 您必須建立和驗證將存取 MongoDB Atlas 叢集的資料庫使用者。若要存取專案中的叢集，使用者必須屬於該專案，而且可以屬於多個專案。 | DBA | 
| 建立自訂角色。 | （選用） 在內建 Atlas 資料庫使用者許可未涵蓋您想要的許可集的情況下，Atlas 支援建立自訂角色。 | DBA | 
| 設定 VPC 對等互連。 | （選用） Atlas 支援與其他 [VPC 對等互連](https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html) AWS。 VPCs  | AWS 管理員 | 
| 設定 AWS PrivateLink 端點。 | （選用） 您可以使用 在 上設定私有端點 AWS AWS PrivateLink。如需詳細資訊，請參閱 [Amazon VPC 文件](https://docs.aws.amazon.com/vpc/latest/userguide/endpoint-services-overview.html)。 | AWS 管理員 | 
| 啟用雙重驗證。 | （選用） Atlas 支援雙重驗證 (2FA)，以協助使用者控制對其 Atlas 帳戶的存取。 | AWS 管理員 | 
| 使用 LDAP 設定使用者身分驗證和授權。 | （選用） Atlas 支援使用輕量型目錄存取通訊協定 (LDAP) 執行使用者身分驗證和授權。 | DBA | 
| 設定統一 AWS 存取。 | （選用） 某些 Atlas 功能，包括使用客戶金鑰管理的 Atlas Data Lake 和靜態加密，使用 AWS Identity and Access Management (IAM) 角色進行身分驗證。 | AWS 管理員 | 
| 使用 設定靜態加密 AWS KMS。 | （選用） Atlas 支援使用 AWS Key Management Service (AWS KMS) 加密儲存引擎和雲端供應商備份。 | AWS 管理員 | 
| 設定用戶端欄位層級加密。 | （選用） Atlas 支援用戶端欄位層級加密，包括欄位的自動加密。 | AWS 管理員 | 

### 遷移資料
<a name="migrate-data"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 將 MongoDB Relational Migrator 新增至存取清單。 | 將 Relational Migrator 新增至來源資料庫的存取清單。這有助於準備來源環境以連線到目標 Atlas 叢集。 | DBA | 
| 評估關聯式資料庫物件。 | 啟動 MongoDB Relational Migrator 並連線至您的關聯式資料庫。開始評估。 | DBA | 
| 接受遷移模式，或選擇根據您的業務需求進行修改。 | 您可以接受 Relational Migrator 根據初始評估和效能參數建議的資料庫模式，或選擇根據您的業務需求進行變更。 | DBA | 
| 在 MongoDB Atlas 中啟動您的目標複本集。 | 在 MongoDB Atlas 中啟動您的目標複本集。在關聯式 Migrator 中，選擇**我已準備好遷移**。 | DBA | 

### 設定操作整合
<a name="configure-operational-integration"></a>


| 任務 | Description | 所需的技能 | 
| --- | --- | --- | 
| 連線至 MongoDB Atlas 叢集。 | 請確定 MongoDB Atlas 叢集連線如預期般運作。 | 應用程式擁有者 | 
| 與叢集資料互動。 | 驗證叢集資料。 | DBA | 
| 監控您的叢集。 | 確認您的叢集設定正確。 | DBA | 
| 備份和還原叢集資料。 | 定期排程叢集資料的備份。 | DBA | 

## 相關資源
<a name="migrate-relational-database-to-mongodb-atlas-resources"></a>

除非另有說明，否則下列所有連結都會移至 MongoDB 文件中的網頁。

**遷移指南**
+ [在 上遷移至 MongoDB Atlas AWS](https://docs.aws.amazon.com/prescriptive-guidance/latest/migration-mongodb-atlas/) (AWS 方案指引）

**探索和評估**
+ [記憶體](https://docs.atlas.mongodb.com/sizing-tier-selection/#memory)
+ [使用 Atlas 範例資料集調整大小範例](https://www.mongodb.com/docs/atlas/sizing-tier-selection/#example--the-service-sample-data-sets)
+ [行動應用程式的大小調整範例](https://www.mongodb.com/docs/atlas/sizing-tier-selection/#example--mobile-app)
+ [網路流量](https://docs.atlas.mongodb.com/sizing-tier-selection/#network-traffic)
+ [叢集自動擴展](https://www.mongodb.com/docs/atlas/sizing-tier-selection/#cluster-auto-scaling)
+ [Atlas 大小調整範本](https://view.highspot.com/viewer/5f438f47a4dfa042e97130c5)

**設定安全與合規**
+ [設定 IP 存取清單項目](https://docs.atlas.mongodb.com/security/ip-access-list/)
+ [設定資料庫使用者](https://docs.atlas.mongodb.com/security-add-mongodb-users/)
+ [設定對 Atlas UI 的存取](https://docs.atlas.mongodb.com/organizations-projects/)
+ [設定自訂資料庫角色](https://docs.atlas.mongodb.com/security-add-mongodb-roles)
+ [設定資料庫使用者](https://docs.atlas.mongodb.com/security-add-mongodb-users/#atlas-user-privileges)
+ [設定網路對等連線](https://docs.atlas.mongodb.com/security-vpc-peering/)
+ [了解 Atlas 中的私有端點](https://docs.atlas.mongodb.com/security-private-endpoint/)
+ [管理您的多重要素驗證選項](https://docs.atlas.mongodb.com/security-two-factor-authentication/)
+ [使用 LDAP 設定使用者身分驗證和授權](https://docs.atlas.mongodb.com/security-ldaps/)
+ [Atlas Data Lake](https://docs.mongodb.com/datalake/)
+ [使用客戶金鑰管理進行靜態加密](https://docs.atlas.mongodb.com/security-kms-encryption/)
+ [擔任角色的方法 ](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html)(IAM 文件）
+ [用戶端欄位層級加密](https://docs.mongodb.com/manual/core/security-client-side-encryption)
+ [自動加密](https://docs.mongodb.com/manual/core/security-automatic-client-side-encryption) 
+ [MongoDB Atlas 安全控制](https://webassets.mongodb.com/_com_assets/cms/MongoDB_Atlas_Security_Controls-v7k3rbhi3p.pdf)
+ [MongoDB 信任中心](https://www.mongodb.com/cloud/trust)
+ [設定叢集的安全功能](https://docs.atlas.mongodb.com/setup-cluster-security/)

**在 上設定新的 MongoDB Atlas 環境 ****AWS**
+ [雲端供應商和區域](https://docs.atlas.mongodb.com/cloud-providers-regions/)
+ [管理全域叢集](https://docs.atlas.mongodb.com/global-clusters/)
+ [選取叢集層](https://www.mongodb.com/docs/atlas/manage-clusters/#select-cluster-tier)
+ [設定其他設定](https://docs.atlas.mongodb.com/cluster-additional-settings/)
+ [Atlas 入門](https://docs.atlas.mongodb.com/getting-started/)
+ [設定對 Atlas UI 的存取](https://docs.atlas.mongodb.com/organizations-projects/)

**遷移資料**
+ [遷移或匯入資料](https://www.mongodb.com/docs/atlas/import/)

**監控叢集**
+ [監控您的叢集](https://docs.atlas.mongodb.com/monitoring-alerts/)

**整合 操作**
+ [連線至叢集](https://docs.atlas.mongodb.com/connect-to-cluster/)
+ [與您的資料互動](https://docs.atlas.mongodb.com/data-explorer/)
+ [監控您的叢集](https://docs.atlas.mongodb.com/monitoring-alerts/)
+ [備份、還原和封存資料](https://docs.atlas.mongodb.com/backup-restore-cluster/)