【问题标题】:How can I programmatically determine which Datastore indexes are in error?如何以编程方式确定哪些 Datastore 索引有误?
【发布时间】:2017-03-24 04:21:41
【问题描述】:

当我在 Google 数据存储上运行 update_indexes 时,我收到以下消息。它告诉我通过查看 GUI 来确定哪些索引有误,然后删除这些索引。

在 200 个索引中,我有 51 个错误的索引,从 GUI 中复制它们是不可行的。

(编辑:通过费力地从 datastore-indexes.xml 中删除和添加索引,我们确定了一个有问题的索引。)

良好的 devops 程序要求我们自动执行此类操作。

如何以编程方式确定哪些索引出错? (Python、bash 甚至 Java 都可以。)

Cannot build indexes that are in state ERROR.To vacuum and rebuild your indexes:
1. Create a backup of your index.yaml specification.
2. Determine the indexes in state ERROR from your admin console: https://appengine.google.com/datastore/indexes?&app_id=s~myproject
3. Remove the definitions of the indexes in ERROR from your index.yaml file.
4. Run "appcfg.py vacuum_indexes your_app_dir/"
5. Wait until the ERROR indexes no longer appear in your admin console.
6. Replace the modified version of your index.yaml file with the original.
7. Run "appcfg.py update_indexes your_app_dir/"

【问题讨论】:

    标签: google-app-engine google-cloud-datastore devops database-indexes


    【解决方案1】:

    很遗憾,Cloud Datastore 没有用于管理索引的公共 API,并且当前的命令行工具使用的内部 API 无法访问该信息。

    我们的目标是在明年某个时候推出一个索引管理 API(已经在进行设计),我会确保我们涵盖这个关键用例。

    【讨论】:

      猜你喜欢
      • 2010-09-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-14
      • 2010-09-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多