elasticdump备份elasticsearch里面的某个索引数据

1、     安装环境

需要node、npm、yarn

# 去官方下载最新版本的nodejs

#wget https://nodejs.org/dist/v6.10.2/node-v6.10.2-linux-x64.tar.xz --no-check-certificate

# npm install –g yarn

# yarn install –g elasticdump

2、     备份操作

!备份到文件:

# elasticdump  --input=http://192.168.1.11:9200/userlog  --output=/data/userlog.json --type=data

!备份到另外的索引

# elasticdump  --input=http://192.168.1.11:9200/userlog  --output=http://192.168.1.11:9200/userlognew --type=data

3、     恢复索引

# elasticdump --input=/data/userlog.json --output=http://192.168.1.11:9200/userlog  --type=data

以下摘自https://www.npmjs.com/package/elasticdump

# Copy an index from production to staging with analyzer and mapping:

elasticdump \

--input=http://production.es.com:9200/my_index \

--output=http://staging.es.com:9200/my_index \

--type=analyzer

elasticdump \

--input=http://production.es.com:9200/my_index \

--output=http://staging.es.com:9200/my_index \

--type=mapping

elasticdump \

--input=http://production.es.com:9200/my_index \

--output=http://staging.es.com:9200/my_index \

--type=data

# Backup index data to a file:

elasticdump \

--input=http://production.es.com:9200/my_index \

--output=/data/my_index_mapping.json \

--type=mapping

elasticdump \

--input=http://production.es.com:9200/my_index \

--output=/data/my_index.json \

--type=data

# Backup and index to a gzip using stdout:

elasticdump \

--input=http://production.es.com:9200/my_index \

--output=$ \

| gzip > /data/my_index.json.gz

# Backup the results of a query to a file

elasticdump \

--input=http://production.es.com:9200/my_index \

--output=query.json \

--searchBody '{"query":{"term":{"username": "admin"}}}'

Docker install

# docker pull taskrabbit/elasticsearch-dump
# docker run --rm -ti taskrabbit/elasticsearch-dump
you'll need to mount your file storage dir -v <your dumps dir>:<your mount point> to your docker container:挂载存储目录,存储备份数据
example:
 
# Copy an index from production to staging with mappings:
docker run --rm -ti taskrabbit/elasticsearch-dump \
  --input=http://production.es.com:9200/my_index \
  --output=http://staging.es.com:9200/my_index \
  --type=mapping
docker run --rm -ti taskrabbit/elasticsearch-dump \
  --input=http://production.es.com:9200/my_index \
  --output=http://staging.es.com:9200/my_index \
  --type=data
 
# Backup index data to a file:
docker run --rm -ti -v /data:/tmp taskrabbit/elasticsearch-dump \
  --input=http://production.es.com:9200/my_index \
  --output=/tmp/my_index_mapping.json \
  --type=mapping

elasticdump的更多相关文章

  1. elasticdump 方法迁移数据

    elasticdump -rm -ti taskrabbit/elasticsearch-dump --ignore-errors=true --offset=1000  --input=http:/ ...

  2. Elasticsearch数据迁移工具elasticdump工具

    1. 工具安装 wget https://nodejs.org/dist/v8.11.2/node-v8.11.2-linux-x64.tar.xz tar xf node-v8.11.2-linux ...

  3. ELK之elasticdump迁移es数据

    参考:https://www.cnblogs.com/resn/p/9082663.html elasticsearch部分查询语句 获取集群节点列表 curl "172.16.30.55: ...

  4. Elasticsearch的数据导出和导入操作(elasticdump工具),以及删除指定type的数据(delete-by-query插件)

    Elasticseach目前作为查询搜索平台,的确非常实用方便.我们今天在这里要讨论的是如何做数据备份和type删除.我的ES的版本是2.4.1. ES的备份,可不像MySQL的mysqldump这么 ...

  5. elasticsearch-dump 迁移es数据 (elasticdump)

    elasticsearch 部分查询语句 # 获取集群的节点列表: curl 'localhost:9200/_cat/nodes?v' # 列出所有索引: curl 'localhost:9200/ ...

  6. elasticsearch数据转移,elasticdump的安装使用

    模拟: 将本地的my_index的products的一条document转移到http://192.168.111.130的一个es服务器上. (一)安装elasticdump 先安装node.js, ...

  7. elasticsearch将数据导出json文件【使用elasticdump】

    1.前提准备 需要使用npm安装,还未安装的朋友可以阅读另一篇我的博客<安装使用npm>,windows环境. 2.安装es-dump 打开终端窗口PowerShell或者cmd. 输入命 ...

  8. 使用elasticdump导入导出数据

    一.安装elasticdump 终端中输入 npm install elasticdump -g -g表示全局可用,直接在终端输入 elasticdump --version,出现版本信息即表示安装成 ...

  9. elasticDump的安装使用

    官方地址:官方地址:https://github.com/taskrabbit/elasticsearch-dump 安装方式如下:安装NodeJS下载源码:wget http://nodejs.or ...

随机推荐

  1. mySQl数据库中不能插入中文的处理办法

    1. 修改MySQL安装目录下(C:\Program Files\MySQL\MySQL Server 5.5)的my.ini文件 设置: default-character-set=utf8 cha ...

  2. jquery ui widgets-datepicker

    jquery ui的用法就不在此讲述,直接进入jquery ui的窗体小部件(widgets)——datepicker. 相信很多像我这样子的菜鸟少年,如果同一个页面上有两个input文本输入框是用来 ...

  3. Git Commit 标准化

    1 前言Git Commit Message 应该清晰明了,要用精简的语言说明本次提交的目的,其主要作用是为了后续的搜索.版本的回滚.合并冲突的追溯等操作. 我们在开发时一直以来对 Git Commi ...

  4. 一般处理程序获取Layui上传的图片

    asp.net利用一般处理程序获取用户上传的图片,上传图片利用的layui 前台页面 <%@ Page Language="C#" AutoEventWireup=" ...

  5. SQL查询和替换含有回车,空格,TAB,等

    ---如下是查询语句 --查询名称有退格键 ),item_name) go --查询名称有制表符tab ),item_name) go --查询名称有换行 ),item_name) go --查询名称 ...

  6. Cordova - OSX中,nodev7.5.0无法安装cordova解决方法!

    OSX:10.12.3 node:v7.5.0 结果很搞笑啊,先前怎么安装都不成功,现在居然安装成功了!我认为安装失败最大的原因是:你不能访问谷歌的原因!!!! 使用最新稳定版,有助于安装,可以顺便安 ...

  7. 使用pipreqs生成项目依赖

    作用 导出当前项目的环境依赖 使用 # 安装 pip3 install pipreqs # 导出项目环境依赖 pipreqs ./ # 如果是Windows系统,会报编码错误 (UnicodeDeco ...

  8. jzoj1407

    首先設在整個數組內可以直接到達n+1的最左邊的點點為x 則x+1-n區間都可以一次或2次到達n+1 如果某一個點i可以一次到達n+1,則其i+a[i]大於等於n+1 否則可以先跳到i再跳到n+1,需要 ...

  9. ifconfig-dropped

    drop的包是因为网卡的buffer满了 查看当前网卡的buffer size情况 ethtool -g eth0 Ring parameters for eth0: Pre-set maximums ...

  10. Centos出现-bash: unzip: command not found的解决办法

    利用unzip命令解压缩的时候,出现-bash:  unzip: command not found的错误. unzip——命令没有找到,其原因肯定是没有安装unzip. 利用一句命令就可以解决了.  ...