Elasticsearch 6.x S3备份恢复手册

1. 配置备份

1.1. 安装repository-s3插件

每个Elasticsearch节点都要安装,若数据库已启动需要重启节点;若其他相同版本的集群Elasticsearch节点已安装repository-s3插件,可以从其他节点直接拷贝。

# elasticsearch-plugin install repository-s3

1.2. 配置JVM参数

在创建对象存储之前,需要在 jvm.options 中添加参数:

# vim jvm.options
新增如下配置:
-Des.allow_insecure_settings=true

1.3. 申请对象存储

若使用讯飞云对象存储,可到讯飞云官网进行申请。创建快照仓库时,需要下表的accessKey和secretKey,不需要AccessKeyID和AccessKeySecret。

AccessKey ID accessKey AccessKey Secret secretKey bucket endpoint base_path 状态
************* ********************* ************************** ************************************* <bucket_name> http://<endpoint_IP>:<endpoint_PORT> <bucket_name> 启用

1.4. 创建快照仓库

1)测试endpoint的连通性

# telnet <endpoint_host> <endpoint_port>
Trying <endpoint_host>...
Connected to <endpoint_host>.
Escape character is '^]'.
^]
telnet> quit
Connection closed.

2)创建快照仓库,快照仓库名为<snapshot_warehouse_name>

快照保存它创建的时间点上所有跟集群相关的数据,包括集群状态和索引的信息。在创建第一个快照之前,必须创建一个快照存储库。

# curl -H "Content-Type: application/json" -XPUT 'http://<elasticsearch_host>:<elasticsearch_port>/_snapshot/<snapshot_warehouse_name>' -d '
{
   
  "type": "s3",
  "settings": {
   
        "endpoint": "http://<endpoint_IP>:<endpoint_PORT>", 
        "access_key": "*********************",
        "secret_key": "*************************************",
        "bucket": "<bucket_name>",
        "base_path" : "<bucket_name>",
 	    "chunk_size" : "200mb", 
        "max_restore_bytes_per_sec" : "50mb",
        "max_snapshot_bytes_per_sec" : "50mb",
        "compress": true
  }
}'


请注意:若提供的"access_key""secret_key"不正确的话,会报如下错误:
{
   
	"error": {
   
		"root_cause": [{
   
			"type": "blob_store_exception",
			"reason": "Failed to check if blob [master.dat-temp] exists"
		}],
		"type": "blob_store_exception",
		"reason": "Failed to check if blob [master.dat-temp] exists",
		"caused_by": {
   
			"type": "amazon_s3_exception",
			"reason": "Forbidden (Service: Amazon S3; Status Code: 403; Error Code: 403 Forbidden; Request ID: tx00000000000002241b610-0060a6b117-8efa7e-default; S3 Extended Request ID: null)"
		}
	},
	"status": 500
}

3)确认备份仓库是否创建成功
# curl -H "Content-Type: application/json" -XPOST http://<elasticsearch_host>:<elasticsearch_port>/_snapshot/<snapshot_warehouse_name>/_verify?pretty


{
   
  "nodes" : {
   
    "c4caXoXdT1iaKt8Q0j4zvA" : {
   
      "name" : "elasticsearch_node1"
    },
    "V8J66mq3ScaatOh-b9u0Fw" : {
   
      "name" : "elasticsearch_node2"
    },
    "mzRuQoWKS1qaedpo1cBslQ" : {
   
      "name" 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Zhi@Li

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值