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. JAVA实现WC.exe功能

    项目要求 实现一个统计程序,它能正确统计程序文件中的字符数.单词数.行数,以及还具备其他扩展功能,并能够快速地处理多个文件. 具体功能要求: 程序处理用户需求的模式为: wc.exe [paramet ...

  2. ActiveMq 配置多队列

    一直在赶项目,好久没有写博文了,中间偶尔有些代码什么的,也都是放到github了,不过大多都是测试代码,毕竟有些成型的东西是给公司写的,鉴于职业道德,还是不好公开. 言归正传,这两天在接入第三方的收费 ...

  3. Transaction And Lock--唯一索引下INSERT导致的死锁

    背景: 曾经的一位同事问我:"数据库只有并发INSERT 操作,会造成死锁么?",我没有太多思考地回答"不会",但真的不会吗? 测试: --========== ...

  4. asp.net 下载EXCEL文件

    一.需要导入NPOI 库文件 打开VS2012 工具>>库程序包管理器>>管理解决方案的NuGet程序包,搜索NPOI,如下图 安装完成: 添加 using NPOI.HSSF ...

  5. Socket网络编程(TCP/IP/端口/类)和实例

    Socket网络编程(TCP/IP/端口/类)和实例 原文:C# Socket网络编程精华篇 转自:微冷的雨 我们在讲解Socket编程前,先看几个和Socket编程紧密相关的概念: TCP/IP层次 ...

  6. Kettle有什么功能

    转载地址:https://www.cnblogs.com/gala1021/p/7814712.html 简介 Kettle是一款国外开源的ETL工具,纯java编写,可以在Window.Linux. ...

  7. 一步一步学习Swift之(二):好玩的工具playground与swfit基础语法

    playground好于在于能一边写代码一边看到输出的常量变量的值.不需要运行模拟器. 我们来试一下该工具的用法. 打开xcode6开发工具,选择Get started with a playgrou ...

  8. Zimbra无需登录RCE漏洞利用

    2019年3月13号,一名国外的安全研究员在他的博客上公布了zimbra RCE漏洞相关信息,但其中并未提到一些漏洞利用细节. 经过一段时间努力,根据网上各位大牛的分析和我自己的理解,在此我将整个漏洞 ...

  9. Android的四大组件学习

    一.Linearlayout  :  线性布局 1. android:orientation="vertical"     //控件的方向控制,vertical : 垂直布局 ,  ...

  10. 字符串搜索 find()

    参考 <C++ Primer Plus>中文版 P870 #include <map> #include <fstream> #include <iostre ...