View a markdown version of this page

從 MongoDB 遷移至 Amazon DocumentDB:線上 - 從 MongoDB 遷移至 Amazon DocumentDB

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

從 MongoDB 遷移至 Amazon DocumentDB:線上

此架構說明如何使用 AWS Database Migration Service (AWS DMS) 的線上方法,從 遷移MongoDB至 Amazon DocumentDB。這種方法提供接近零的停機時間,並具有中等複雜性。

從 MongoDB 遷移至 Amazon DocumentDB:線上方法

架構圖顯示使用 AWS DMS 從 MongoDB 到 Amazon DocumentDB 的線上遷移方法。

下列步驟說明 架構:

  1. 當您使用線上方法遷移至 Amazon DocumentDB 時,您的應用程式會繼續寫入來源MongoDB資料庫。

  2. 在與您的 Amazon DocumentDB 叢集相同的 VPC 中建立 Amazon EC2 執行個體,並安裝 mongo shell。 Amazon DocumentDB 建立從 Amazon EC2 執行個體到MongoDB來源的連線,然後使用 mongodump 工具將資料索引匯出至 Amazon EC2 遷移執行個體。

  3. AWS DMS 使用完整資料載入和變更資料擷取 (CDC) 來啟用資料庫遷移。線上遷移方法使用 AWS DMS 執行完整資料複製,並使用 CDC 將差異變更複寫至 Amazon DocumentDB。若要改善 AWS DMS 完整資料載入遷移的效能,請使用自動分割或範圍分割選項。

  4. 使用步驟 2 中建立的 Amazon EC2 執行個體連線至 Amazon DocumentDB 叢集以遷移索引。使用 Amazon DocumentDB 索引工具來檢查傾印索引的相容性,並在目標 Amazon DocumentDB 叢集上預先建立索引。

  5. 當資料同步時,切換應用程式的資料庫連線字串以使用新的目標 Amazon DocumentDB 叢集。