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. Need You Now --Lady Antebellum

    战地女神(Lady Antebellum)由女主唱 Hillary Scott.男主唱 Charles Kelley .吉他/键盘手 Dave Haywood,2006夏天在美国乡村音乐重镇纳什维尔组 ...

  2. JSP、Servlet中get请求和post请求的区别总结

    在学习JavaWeb最初的开始阶段,大家都会遇到HttpServlet中的doGet和doPost方法.前两天看<Head First Servlets & JSP>看到其中讲关于 ...

  3. SpringMVC绑定到实体数组、list、set、和map时要注意

    实体的属性前一定要用.分割,如果是使用jquery的ajax提交的一个js数组对象,则请求数据会被格式化为 var sub = [{name:1,num:2},{name:1,num:2}] $.po ...

  4. 在Sublime中集成Team Foundation Server (TFS),实现版本管理

    Sublime是一款具有代码高亮.语法提示.自动完成且反应快速的编辑器软件,由于它开发的技术架构.丰富的插件,和轻盈而快速的编程响应,Sublime广受程序员的爱好.在C, C++, Javascri ...

  5. jquery chosen 插件多选初始化

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  6. 在QT中用git做版本管理时遇到的一些问题

    1. 安装git sudo apt-get install git 2. 安装gitk sudo apt-get install gitk 要提交代码,点击  工具->git->local ...

  7. OpenStack kolla 多 region 部署配置

    region one: cat /etc/kolla/globals.yml openstack_region_name: "RegionOne" multiple_regions ...

  8. 2018-2019-2 网络对抗技术 20165219 Exp6 信息搜集与漏洞扫描

    2018-2019-2 网络对抗技术 20165219 Exp6 信息搜集与漏洞扫描 实验内容 各种搜索技巧的应用 DNS IP注册信息的查询 基本的扫描技术:主机发现.端口扫描.OS及服务版本探测. ...

  9. BZOJ3775: 点和直线(计算几何+拉格朗日乘数法)

    题面 传送门 题解 劲啊-- 没有和\(Claris\)一样推,用了类似于\(Shinbokuow\)推已知点求最短直线的方法,结果\(WA\)了好几个小时,拿\(Claris\)代码拍了几个小时都没 ...

  10. Xcode的多种Build Configuration

    一: 建多个Configuration的目的. 多套域名打包. 1 开发时的域名. 2 内测时的域名. 3 公测时的域名. 4 企业版的域名. 5 APP Store的域名. 通过注释的方式,容易出错 ...