【问题标题】:Migrating Elasticsearch logs to a different cluster将 Elasticsearch 日志迁移到不同的集群
【发布时间】:2021-01-08 03:15:25
【问题描述】:

我在 Kubernetes (AKS) 上部署了 Elasticsearch。我正在使用官方 Elastic 的 docker 镜像进行部署。日志存储在持久性 Azure 磁盘中。如何将其中一些日志迁移到具有类似设置的另一个集群?只有那些符合日志日期时间过滤条件的日志才需要迁移。

【问题讨论】:

  • 您可以使用带有 {input, filters, output} 管道的 logstash。
  • @Sahil 非常感谢,它正在工作。但是我一次只能获取 10000 个文档,而实际文档数量超过一百万。

标签: docker elasticsearch logging elastic-stack elk


【解决方案1】:

请使用Reindex API 实现同样的效果

POST _reindex
{
  "source": {
    "remote": {
      "host": "http://oldhost:9200",
      "username": "user",
      "password": "pass"
    },
    "index": "source",
    "query": {
      "match": {
        "test": "data"
      }
    }
  },
  "dest": {
    "index": "dest"
  }
}

注意:

  1. 在您的目标实例上运行上述命令。

  2. 确保源实例在 elasticsearch.yml 中列入白名单

      reindex.remote.whitelist: oldhost:9200
    
  3. 使用以下查询参数异步运行该过程

    POST _reindex?wait_for_completion=false 
    

【讨论】:

  • 我试过了(30k 文档和非远程重新索引),它适用于 30k 文档。
猜你喜欢
  • 2020-06-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-02-08
  • 2021-09-14
  • 1970-01-01
  • 1970-01-01
  • 2020-11-16
相关资源
最近更新 更多