zoukankan      html  css  js  c++  java
  • 基于docker使用elasticsearch-dump,es数据导入导出

    1.拉去dump镜像

    [root@localhost ~]# docker pull taskrabbit/elasticsearch-dump
     

    2.相关实例

    1.创建文件存放路径

    [root@localhost ~]# mkdir -p /data/
    2.将索引数据备份到文件

    [root@localhost ~]# docker run --rm -ti -v /data/:/tmp taskrabbit/elasticsearch-dump --input=http://192.168.1.2:9200/my_index --output=/tmp/dump.json --type=data
     

    3.将旧环境数据导入到新环境

    [root@localhost ~]# docker run --rm -ti elasticsearch-dump --input=http://192.168.1.2:9200/my_index --output=http://192.168.1.2:9200/my_index --type=data
    3.将文件导入到es数据库中

    [root@localhost ~]# docker run --rm -ti -v /data:/tmp taskrabbit/elasticsearch-dump --input=/tmp/dump.json --output=http://192.168.1.2:9200/my_index --type=data
     

    官方文档:https://github.com/taskrabbit/elasticsearch-dump?utm_source=dbweekly&utm_medium=email

     上面写的只是导入导出es的数据的,如果要把es的索引结构和mapping还有数据导出可以用下面方式:

    导出es的mapping 

    docker run --rm -ti -v /root/es_dump_data/:/tmp taskrabbit/elasticsearch-dump --input=http://15.31.213.92:9200/dw_task_progress_index --output=/tmp/dw_task_progress_index_mapping.json --type=mapping

    导出analyzer(没有分词就不需要)

    docker run --rm -ti -v /root/es_dump_data/:/tmp taskrabbit/elasticsearch-dump --input=http://15.31.213.92:9200/dw_task_progress_index --output=/tmp/dw_task_progress_index_analyzer.json --type=analyzer

    导出es数据

    docker run --rm -ti -v /root/es_dump_data/:/tmp taskrabbit/elasticsearch-dump --input=http://15.31.213.92:9200/dw_task_progress_index --output=/tmp/dw_task_progress_index.json --type=data

     删除索引

    curl -XDELETE http://15.31.213.44:9200/dw_task_progress_index

    创建索引

    curl -XPUT http://15.31.213.44:9200/dw_task_progress_index -d '
    {

    "settings": {
    "index": {
    "number_of_shards": "3",
    "number_of_replicas": "1"
    }
    }

    }
    '

    导入mapping

    docker run --rm -ti -v /root/es_dump_data:/tmp taskrabbit/elasticsearch-dump --input=/tmp/dw_task_progress_index_mapping.json --output=http://15.31.213.44:9200/ --type=mapping

    导入analyzer(没有分词就不需要)

    docker run --rm -ti -v /root/es_dump_data:/tmp taskrabbit/elasticsearch-dump --input=/tmp/dw_task_progress_index_analyzer.json --output=http://15.31.213.44:9200/ --type=analyzer

    导入data

     docker run --rm -ti -v /root/es_dump_data:/tmp taskrabbit/elasticsearch-dump --input=/tmp/dw_task_progress_index.json --output=http://15.31.213.44:9200/ --type=data

  • 相关阅读:
    matlab矩阵和矩阵操作基础
    [ZZ] MathType转化为LaTeX公式语言
    [综] 粒子滤波
    [综] Endnote怎么下载杂志格式?
    英语句子的连接方式
    [zz] postscript打印机以及ps文件转eps文件
    [zz]SCI投稿经验
    all, whole, entire, total, complete
    [转] 动态规划 最短路径
    [zz] Dynamic Time Warping 动态时间规整(弯折)
  • 原文地址:https://www.cnblogs.com/xiaohanlin/p/12103679.html
Copyright © 2011-2022 走看看