将数据库从 Spanner 导出到 Avro

本页面介绍了如何使用Google Cloud 控制台导出 Spanner 数据库。

如需使用 REST API 或 Google Cloud CLI 导出 Spanner 数据库,请完成此页面上准备工作部分中的步骤,然后查看 Dataflow 文档中Spanner 到 Cloud Storage Avro 中的详细说明。导出流程使用 Dataflow,并将数据写入 Cloud Storage 存储桶中的文件夹。生成的文件夹包含一组 Avro 文件和 JSON 清单文件。

准备工作

如需导出 Spanner 数据库,首先需要启用 Spanner、Cloud Storage、Compute Engine 和 Dataflow API:

Roles required to enable APIs

To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

Enable the APIs

此外,您还需要足够的配额和必要的 IAM 权限。

配额要求

导出作业的配额要求如下:

  • Spanner:导出数据库不需要额外的计算容量,但您可能需要增加更多计算容量,以便在合理的时间内完成作业。如需了解详情,请参阅