View a markdown version of this page

從 MongoDB 遷移至 Amazon DocumentDB:混合 - 從 MongoDB 遷移至 Amazon DocumentDB

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

從 MongoDB 遷移至 Amazon DocumentDB:混合

此架構說明如何使用 MongoDB 公用程式和 AWS DMS 的混合方法,從 遷移MongoDB至 Amazon DocumentDB。這種方法提供接近零的停機時間,對於大於 1 TB (TB) 的來源資料集,這是建議的選項。

從 MongoDB 遷移至 Amazon DocumentDB:混合方法

架構圖顯示使用 MongoDB 公用程式和 AWS DMS 從 MongoDB 到 Amazon DocumentDB 的混合遷移方法。

下列步驟說明 架構:

  1. 在遷移至 Amazon DocumentDB 的混合方法中,您的應用程式會繼續寫入來源MongoDB資料庫。

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

  3. 使用 mongodump 工具,將資料從MongoDB複本集匯出至 Amazon EC2 遷移執行個體。若要降低 mongodump 對來源的影響,請將 readPreference選項設定為 secondary,強制傾印連接至次要複本集成員。

  4. 使用 Amazon DocumentDB 索引工具還原您在目標 Amazon DocumentDB 叢集中匯出的索引 (步驟 2)。

  5. 若要還原您在步驟 3 中傾印在目標叢集中的資料,請使用 mongorestore 公用程式。

  6. AWS DMS 使用完整資料載入和 CDC 啟用資料庫遷移。混合遷移方法使用 CDC 將變更複寫至 Amazon DocumentDB。

  7. 當資料同步時,請將應用程式的資料庫連線字串變更為使用 Amazon DocumentDB 叢集。