zoukankan      html  css  js  c++  java
  • es迁移索引数据合并

    es集群迁移,大规模迁移过程中,比如我们以当天时间做索引,在新的es集群会存在和老的es集群一样的索引文件名,这个时候用snapshot恢复数据会出现冲突问题。这里我们可以用reindex api来解决:

    这里有两种方式使用

    1.先在原来的es集群将迁移当天的索引文件名reindex,然后做快照,然后用快照恢复重命名的快照,然后重新reindex恢复

    2.先在原来的es集群做快照,然后在新es集群做当日索引文件reindex,然后删除新生成的索引文件,然后从snapshot恢复当日索引文件,然后将当日新数据做reindex 恢复。

    这里举例第二种方式:

    1.查看索引文件

    curl 10.0.67.23:9200/_cat/indices/adsense-2017.*

    2.做reindex

    curl -XPOST '10.0.67.23:9200/_reindex?pretty' -H 'Content-Type: application/json' -d'
    {
    "source": {
    "index": "adsense-2017.11.22-new"
    },
    "dest": {
    "index": "adsense-2017.11.22"
    }
    }
    '

    3.删除当日索引文件

    curl -XDELETE '10.0.67.23:9200/adsense-2017.11.22'

    4.导入老集群当日索引文件

    curl -XPOST "10.0.67.21:9200/_snapshot/es_backup/snapshot-20171123-16/_restore" -d'{ "indices": "adsense-2017.11.22" }'

    5.将当日新数据重新合并到老集群索引文件

    curl -XPOST '10.0.67.23:9200/_reindex?pretty' -H 'Content-Type: application/json' -d'
    {
      "source": {
        "index": "adsense-2017.11.22-new"
      },
      "dest": {
        "index": "adsense-2017.11.22"
      }
    }
    '
  • 相关阅读:
    Luogu P1160 【队列安排】
    Luogu P1566 【加等式】
    CF614A 【Link/Cut Tree】
    AT994 【11の倍数】
    Luogu P2310 【loidc,看看海】
    CF401D 【Roman and Numbers】
    【[国家集训队]小Z的袜子】
    UVA10212 【The Last Non-zero Digit.】
    Luogu P3384 【【模板】树链剖分】
    20161005 NOIP 模拟赛 T2 解题报告
  • 原文地址:https://www.cnblogs.com/mikeluwen/p/7929435.html
Copyright © 2011-2022 走看看