• 基于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

  • 相关阅读:
    SharePoint 2013 列表启用搜索
    SharePoint 2013 InfoPath 无法保存下列表单
    SharePoint 2013 图文开发系列之定义站点模板
    SharePoint 2013 图文开发系列之创建内容类型
    SharePoint 2013 图文开发系列之网站栏
    Linux的PCI驱动分析
    uCOS-ii笔记
    RTOS系统与Linux系统的区别
    Arduino+GPRS 的环境监控方案
    可视化机器学习工具软件的比较分析研究
  • 原文地址:https://www.cnblogs.com/xiaohanlin/p/12103679.html
Copyright © 2020-2023  润新知