跳到主要内容 跳到补充内容

从远程 Elasticsearch 集群重建索引

您需要为您的 Logstash 和 Talend ESB 索引重建索引。

步骤

  1. 运行以下命令查看所有现有的索引:
    curl -XGET 'oldhost9200/_cat/indices'
    oldhost 替换为在 7.2.x 中使用的 Elasticsearch 集群的 IP 地址或主机名。
  2. 从远程集群为您的 Logstash 索引重建索引,以便将文档从 7.3.x 中使用的索引转换为 8.0.x 中使用的索引:
    curl -XPOST 'localhost:9200/_reindex?pretty' -H 'Content-Type: application/json' -d'
    {
      "source": {
        "remote": {
          "host": "http://oldhost:9200"
        },
        "index": "logstash-YYYY.MM.dd"
      },
      "dest": {
        "index": "logstash-YYYY.MM.dd"
      }
    }
    '
  3. 从远程集群为您的 Talend ESB 索引重建索引,以便将文档从 7.3.x 中使用的索引转换为 8.0.x 中使用的索引:
    curl -XPOST 'localhost:9200/_reindex?pretty' -H 'Content-Type: application/json' -d'
    {
      "source": {
        "remote": {
          "host": "http://oldhost:9200"
        },
        "index": "talendesb-YYYY.MM.dd"
      },
      "dest": {
        "index": "talendesb-YYYY.MM.dd"
      }
    }
    '
    信息注释注:

    您必须逐一迁移所有 logstash-YYYY.MM.ddtalendesb-YYYY.MM.dd 索引,或仅选择您想要迁移的索引。

    如果您指定 logstash-* 作为索引名称,您将收到类似如下所示的错误:

    如果您指定 logstash-*talendesb-* 作为索引名称,您将收到类似如下所示的错误:

    "failures" : [
    {
    "index" : "logstash-*",
    "type" : "xxxxxxxx",
    "id" : "xxxxxxxxxxxxxx",
    "cause" : {
    "type" : "invalid_index_name_exception",
    "reason" : "Invalid index name [logstash-*], must not contain the following characters [ , \", *, \\, <, |, ,, >, /, ?]",
    "index_uuid" : "_na_",
    "index" : "logstash-*"
    },
    "status" : 400
    },
    {
    "index" : "logstash-*",
    "type" : "xxxxxx",
    "id" : "xxxxxxxxxxxxxxx",
    "cause" : {
    "type" : "invalid_index_name_exception",
    "reason" : "Invalid index name [logstash-*], must not contain the following characters [ , \", *, \\, <, |, ,, >, /, ?]",
    "index_uuid" : "_na_",
    "index" : "logstash-*"
    },
    "status" : 400
    }
    ]

本页面有帮助吗?

如果您发现此页面或其内容有任何问题 – 打字错误、遗漏步骤或技术错误 – 请告诉我们如何改进!