从 Google 云 sql 迁移到数据存储

Migration from Google cloud sql to datastore

有没有一种简单的方法可以将大型 (100G) Google 云 sql 数据库迁移到 Google 数据存储?

想到的办法是为每个数据库和table写一个pythonappengine脚本,然后放到datastore中。这听起来很乏味,但也许必须这样做?

旁注,我离开云的原因 sql 是因为我有 jsp 个页面,上面有多个查询,即使使用 d32 sql 实例,它们也非常慢.我希望将其放入数据存储区会更快?

似乎有很多关于从数据存储迁移到云的问题sql,但我找不到这个问题。

谢谢

这里有几个选项:

  1. 编写一个 App Engine mapreduce [1] 程序,从云 SQL 中以适当的块提取数据并写入数据存储。
  2. 在 Google Compute Engine 上启动 VM 并编写一个程序,从云端获取数据 SQL 并使用外部数据存储 API [2] 写入数据存储。
  3. 使用数据存储还原 [3]。我不熟悉这种格式,所以我不知道要生成恢复将接受的内容需要做多少工作。

[1] https://cloud.google.com/appengine/docs/python/dataprocessing/
[2] https://cloud.google.com/datastore/docs/apis/overview
[3] https://cloud.google.com/appengine/docs/adminconsole/datastoreadmin?csw=1#restoring_data

我在计算引擎上写了几个脚本 运行。

gcp 数据存储api
导入 googledatastore
这是代码:
https://gist.github.com/nburn42/d8b488da1d2dc53df63f4c4a32b95def

和数据流api
从 apache_beam.io.gcp.datastore.v1.datastoreio 导入 WriteToDatastore
这是代码:
https://gist.github.com/nburn42/2c2a06e383aa6b04f84ed31548f1cb09

在达到 100,000 个实体后,我发现配额超出了,我不得不再等一天再做一组。

希望这些对数据库比我小的人有用。

(配额问题在这里 )