繁体   English   中英

如何在快照中找到 Elasticsearch 索引?

[英]How to find Elasticsearch index in snapshot?

我有一个在 AWS 上运行的 Elasticsearch 集群,我有这样的快照

 {
     "snapshot": "2016-07-13_165430",
     "indices": [
        "analytical-2016-06-15",
        "analytical_2016-06-13",
        "analytical_2016-07-13",
        "operational-2016-06-15",
        "operational_2016-06-13",
        "operational_2016-07-13"
     ],
     "state": "SUCCESS",
     "start_time": "2016-10-10T23:54:33.705Z",
     "start_time_in_millis": 1476143673705,
     "end_time": "2016-10-10T23:54:44.893Z",
     "end_time_in_millis": 1476143684893,
     "duration_in_millis": 11188,
     "failures": [],
     "shards": {
        "total": 30,
        "failed": 0,
        "successful": 30
     }
  },
  {
     "snapshot": "2016-07-13_165546",
     "indices": [
        "analytical-2016-06-15",
        "analytical_2016-06-13",
        "analytical_2016-07-13",
        "operational-2016-06-15",
        "operational_2016-06-13",
        "operational_2016-07-13"
     ],
     "state": "SUCCESS",
     "start_time": "2016-10-10T23:55:48.808Z",
     "start_time_in_millis": 1476143748808,
     "end_time": "2016-10-10T23:55:52.420Z",
     "end_time_in_millis": 1476143752420,
     "duration_in_millis": 3612,
     "failures": [],
     "shards": {
        "total": 30,
        "failed": 0,
        "successful": 30
     }
  }

现在所有这些指数都与其他一些指数一起在线运行:“analytical-2016-06-15”,
"analytical_2016-06-13",
"analytical_2016-07-13",
"操作-2016-06-15",
"operational_2016-06-13",
“操作_2016-07-13”
“操作_2016-09-13”
....

我需要检查我的索引是否已备份,以及是否已备份它存在于哪个快照中。

我怀疑@air 对查找包含给定索引的许多快照中的哪一个感兴趣; 粘贴的示例只是快照历史记录的一种视图。 当您在一段时间内拍摄每日快照并添加/删除索引时,手动搜索将是一件苦差事。

似乎没有“找到我所有包含索引operational_2021-06-10 _2021-06-10的快照”的API调用,但这里有一个自动化选项:

 curl -XGET "http://cluster:9200/_snapshot/myrepo/*" |
   jq -c '.snapshots[] | select(.indices | index("operational_2021-06-10")) | { snapshot }'

{"snapshot":"daily-snap-2021.06.10-hjmskkjsryyq82asmxiuva"}
{"snapshot":"daily-snap-2021.06.11-eayyiiort0cx97r_jscara"}
{"snapshot":"daily-snap-2021.06.12-rmrsbmsespgf0_czu721hw"}
{"snapshot":"daily-snap-2021.06.13-meeoachori61w5r3n3qzaq"}
{"snapshot":"daily-snap-2021.06.14-espbnhuprcckqylk3xltwq"}
{"snapshot":"daily-snap-2021.06.15-sbosayasthinaudxaqw3pa"}

我对你的问题感到困惑,因为你发布了快照 json,它告诉你每个快照中备份了哪些索引。 您需要遍历每个快照存储库中的每个快照(我认为您已经知道该怎么做)并查看每个快照中的索引。

这是 AFAIK 确定已备份哪些索引、何时以及由哪些快照备份的唯一方法。

这是快照 api 的文档: https : //www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM