【问题标题】:How to copy elasticsearch indices or logs from one elasticsearch server to another?如何将弹性搜索索引或日志从一个弹性搜索服务器复制到另一台?
【发布时间】:2023-03-27 22:42:02
【问题描述】:

例如: 从 https://localhost:9200 获取索引“index_name” 到 https://localhost:9300 索引'index2_name'

【问题讨论】:

    标签: elasticsearch data-migration elk server-to-server


    【解决方案1】:
    ----------
    This can be easily and seamlessly done using elasticdump:
    
    1. I used git bash (cli) to install elasticdump: npm install elasticdump -g
    2. Download logs to a local json file:
    NODE_TLS_REJECT_UNAUTHORIZED=0 elasticdump \
      --input=https://localhost:9200/{index_name} \
      --output=index_name.json \
      --type=data
    
    NOTE: NODE_TLS_REJECT_UNAUTHORIZED=0 is for a secured elasticsearch
    
    3. From one elasticsearch server to another 
    NODE_TLS_REJECT_UNAUTHORIZED=0 elasticdump \
      --input=https://localhost:9200/{index_name} \
      --output=https://localhost:9300/{index2_name} \
      --type=data
    
    NOTE: NODE_TLS_REJECT_UNAUTHORIZED=0 is for a secured elasticsearch.
          index2_name in the index for the second server (you can use mappings first to create the index before copying over the data, that's if you believe you have 'mapping conflicts' or for best practice)
    
    
    Here is a refence video on youtube with an example.
    https://www.youtube.com/watch?v=Sp7eV0LQzts
    

    【讨论】:

    • @saeed 我以前用过这个,它需要在 elasticsearch.yml 上进行一些配置...上面的解决方案不需要任何配置,它只需要安装 elasticdump 然后你就完成了
    【解决方案2】:

    您还可以使用远程重新索引将数据从一个集群传输到另一个集群。你可以看看怎么做here

    【讨论】:

      猜你喜欢
      • 2016-03-13
      • 2014-12-20
      • 2021-10-09
      • 1970-01-01
      • 1970-01-01
      • 2014-01-06
      • 2018-08-09
      • 2017-11-25
      • 1970-01-01
      相关资源
      最近更新 更多