elasticdump安装_elasticdump备份及恢复es数据

1.elasticdump备份还原

1.1elasticdump 简介

用于转移和保存ES索引数据

# 获取集群的节点列表:

curl 'localhost:9200/_cat/nodes?v'

# 列出所有索引:

curl 'localhost:9200/_cat/indices?v'

创建一个名为“customer”的索引,然后再查看所有的索引:

curl -X PUT 'localhost:9200/customer?pretty'

curl 'localhost:9200/_cat/indices?v'

如果需要用户名和密码登录才可以访问,通过下面的方式指定用户名和密码

# 获取集群的节点列表:

curl --user username:password 'localhost:9200/_cat/nodes?v'

1.2前置条件

elasticdump具有两种两种方式:npm和Docker(假设已存在对应的安装环境,可直接跳转至安装elasticdump步骤),本文只讲述npm的安装方式,Docker的安装方式可以查阅官网文档细节。

1.下载node.js安装包

wget https://nodejs.org/dist/v10.13.0/node-v10.13.0-linux-x64.tar.gz

2. 解压node.js 安装包

tar xf node-v10.13.0-linux-x64.tar.gz

3. 创建链接

ln -s ~/node-v10.13.0-linux-x64/bin/node /usr/bin/node

ln -s ~/node-v10.13.0-linux-x64/bin/npm /usr/bin/npm

2.安装 elasticdump

使用npm安装elasticdump,执行如下命令。

npm install elasticdump -g

2.1elasticdump 使用方法

本文主要介绍数据导出为文件,从文件导入数据这两个常用的方法,但elasticdump并不局限于这两种使用方式,如果对此感兴趣,可以登陆官网查阅更为详细的用法细节。

[root@cndh1323-2-11 bin]# ./elasticdump --help

elasticdump: Import and export tools for elasticsearch

version: 6.27.5

Usage: elasticdump --input SOURCE --output DESTINATION [OPTIONS]

--input

Source location (required)

--input-index

Source index and type

(default: all, example: index/type)

--output

Destination location (required)

--output-index

Destination index and type

(default: all, example: index/type)

--overwrite

Overwrite output file if it exists

(default: false)

--limit

How many objects to move in batch per operation

limit is approximate for file streams

(default: 100)

--size

How many objects to retrieve

(default: -1 -> no limit)

--concurrency

How many concurrent request is sent to a specified transport

(default: 1)

--concurrencyInterval

The length of time in milliseconds before the interval count resets. Must be finite.

(default: 5000)

--intervalCap

The max number of transport request in the given interval of time.

(default: 5)

--carryoverConcurrencyCount

Whether the task must finish in the given concurrencyInterval

(intervalCap will reset to the default whether the request is completed or not)

or will be carried over into the next interval count,

which will effectively reduce the number of new requests created in the next interval

i.e. intervalCap -=

(default: true)

--throttleInterval

The length of time in milliseconds to delay between getting data from an inp

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值