Google 数据存储跨区域复制

Google Datastore cross region replication

我们有一个在美国和欧盟托管的应用程序。 为了获得出色的性能,我们将在两个位置托管一个数据存储实例。

现在我们的问题是如何将数据从美国数据存储复制到欧盟数据存储?

或者从技术角度来看,无论我们将数据存储在哪里?

不存在多位置 GAE 应用程序(至少目前还没有)。应用程序的唯一位置可以在创建应用程序时选择并且不能更改。参见 and

来自Creating a project and application的重要说明:

Important: Each Cloud Platform project can contain only a single App Engine application and you cannot change the region after you create the App Engine application.

现在数据存储本身只能存在于单个云项目中,它也映射 1:1 到一个位置。来自 Google Cloud Datastore Locations:

When you create a Google Cloud Platform project, you must choose a location where the project's data is stored. To reduce latency and increase availability, store your data close to the users and services that need it. You can create projects in the following locations:

  • europe-west — Western Europe
  • us-central — Central United States
  • us-east1 — Eastern United States
  • asia-northeast1 — Northeastern Asia-Pacific

App Engine 和 Cloud Datastore 都被列为具有多区域覆盖范围的产品(请参阅 https://cloud.google.com/about/locations/). But that coverage is not global, it still remains contained within a region group. And US and EU are in different region groups, so this won't help you. From Multi-regional resources

The data associated with multi-regional resources is not tied to a specific region and can be moved between regions and regions can be added and removed from a region group. For example, buckets in the European Union location for Google Cloud Storage keep data at-rest inside the European Union, but at-rest data can be stored in or moved to any Cloud Storage region within the European Union (subject to terms of service and service specific terms).

因此,您最多可以在 2 个 不同的 区域中部署 2 个 不同的 GAE 应用程序,最终来自(几乎)相同的代码。

您需要自己负责跨这些应用程序复制数据,例如为此目的在应用程序之间添加 custom/dedicated 通信或使用 Remote API(每个应用程序就像一个其他应用程序远程 API 的客户端)。

很可能不是微不足道的,尤其是在数据一致性很重要的情况下。在这种情况下,您 可能 使用单个应用程序并根据客户的位置对某些客户进行一些性能损失会更好。