现已推出具有 MongoDB 兼容性的 Firestore 企业版!
了解详情。
迁移到具有 MongoDB 兼容性的 Firestore
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
仅与 Cloud Firestore 企业版相关。
|
您可以将与 MongoDB 兼容的源数据库迁移到与 MongoDB 兼容的 Firestore 数据库,且停机时间极短。
迁移步骤
本部分详细介绍了各种迁移步骤。
Datastream 服务会在来源和目标位置之间创建数据流。在这种情况下,源是您当前与 MongoDB 兼容的部署,而目标是 Cloud Storage。此流程包含以下步骤:
为 MongoDB 源创建来源 Datastream 连接配置文件。具体说明取决于 MongoDB 兼容型来源的类型和部署方式。
创建一个 Cloud Storage 存储分区,用于接收来自 MongoDB 兼容型源数据库的数据和更改事件。
创建使用此 Cloud Storage 存储分区的目标 Datastream 连接配置文件。
创建并启动 Datastream 数据流,将来源连接配置文件连接到目标位置连接配置文件。
启动 Dataflow 流水线,开始将捕获的数据注入到具有 MongoDB 兼容性的 Cloud Firestore 数据库中。
监控数据流,以确定迁移过程中的重要里程碑,从而确定数据传输期间是否遇到任何错误。
在适当的时候,关闭对源数据库的写入流量。在将所有数据(包括最近的更改)复制到与 MongoDB 兼容的 Cloud Firestore 数据库后,将读取流量重定向到新目标。
启用对具有 MongoDB 兼容性的 Cloud Firestore 数据库的写入流量。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-29。
[null,null,["最后更新时间 (UTC):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."]]