现已推出具有 MongoDB 兼容性的 Firestore 企业版!
了解详情。
遷移至與 MongoDB 相容的 Firestore
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
僅適用於 Cloud Firestore Enterprise 版。
|
您可以將與 MongoDB 相容的來源資料庫,遷移至與 MongoDB 相容的 Firestore 資料庫,停機時間極短。
遷移步驟
本節將詳細說明各個遷移步驟。
Datastream 服務會在來源和目的地之間建立串流。在本例中,來源是目前的 MongoDB 相容部署作業,目的地則是 Cloud Storage。這項程序包含下列步驟:
為 MongoDB 來源建立來源 Datastream 連線設定檔。具體操作說明取決於 MongoDB 相容來源的類型和部署方式。
建立 Cloud Storage bucket,接收來自 MongoDB 相容來源資料庫的資料和變更事件。
建立目的地 Datastream 連線設定檔,使用這個 Cloud Storage bucket。
建立並啟動 Datastream 串流,將來源連線設定檔連結至目的地連線設定檔。
啟動 Dataflow 管道,開始將擷取的資料注入與 MongoDB 相容的 Cloud Firestore 資料庫。
監控串流
找出遷移程序中的重要里程碑,判斷資料轉移期間是否發生任何錯誤。
在適當時間停止寫入流量至來源資料庫。將所有資料 (包括最近的變更) 複製到具有 MongoDB 相容性的資料庫後,請將讀取流量重新導向至新目的地。Cloud Firestore
啟用寫入流量,
將資料寫入與 MongoDB 相容的 Cloud Firestore 資料庫。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-29 (世界標準時間)。
[null,null,["上次更新時間:2025-08-29 (世界標準時間)。"],[],[],null,["\u003cbr /\u003e\n\n\n|--------------------------------------------------------|\n| *Relevant to Cloud Firestore Enterprise edition only.* |\n\n\u003cbr /\u003e\n\nYou can migrate your MongoDB-compatible source database to a Firestore with\nMongoDB compatibility database with minimal downtime.\n\nMigration steps\n\nThis section details out the various migration steps.\n\nThe Datastream service creates a stream between a source and a destination. In\nthis case, the source is your current MongoDB-compatible deployment, while the\ndestination is Cloud Storage. This process has the following steps:\n\n1. [Create a source Datastream connection profile](https://cloud.google.com/firestore/mongodb-compatibility/docs/migrate-create-connection-profiles)\n for your MongoDB source. Specific instructions depend on the type and the way\n your MongoDB-compatible source is deployed.\n\n2. [Create a Cloud Storage bucket](https://cloud.google.com/firestore/mongodb-compatibility/docs/migrate-configure-resources#create-bucket)\n that will receive the data and the change events from your\n MongoDB-compatible source database.\n\n3. [Create a destination Datastream connection profile](https://cloud.google.com/firestore/mongodb-compatibility/docs/migrate-create-connection-profiles#connection-profile-storage)\n that uses this Cloud Storage bucket.\n\n4. [Create and actuate a Datastream stream](https://cloud.google.com/firestore/mongodb-compatibility/docs/migrate-import-from-source)\n that connects the source connection profile to the destination connection\n profile.\n\n5. [Initiate a Dataflow pipeline](https://cloud.google.com/firestore/mongodb-compatibility/docs/migrate-write-to-destination)\n to begin injecting the captured data into your Cloud Firestore\n with MongoDB compatibility database.\n\n6. [Monitor the stream](https://cloud.google.com/firestore/mongodb-compatibility/docs/migrate-traffic#migration-completion-milestones)\n to identify important milestones in the migration process to determine\n whether any errors were encountered during the data transfer.\n\n7. When it's appropriate, [shut down write traffic](https://cloud.google.com/firestore/mongodb-compatibility/docs/migrate-traffic#shut-down-write-traffic)\n to the source database. After all data, including recent changes, was\n replicated to the Cloud Firestore with MongoDB compatibility\n database, redirect read traffic to the new destination.\n\n8. [Enable write traffic](https://cloud.google.com/firestore/mongodb-compatibility/docs/migrate-traffic#migrate-write-traffic)\n to your Cloud Firestore with MongoDB compatibility database."]]