Elasticsearch GCS Snapshot Exception

获取Elasticsearch策略执行情况

GET /_slm/policy/my-backup-slm?human

报错信息:

  failed to create snapshot successfully, ****** out of ****** total shards failed","stack_trace":"SnapshotException[[my-backup-repository:my-backup-snapshots-******] failed to create snapshot successfully, ****** out of ****** total shards failed]\n\tat 
  org.elasticsearch.xpack.slm.SnapshotLifecycleTask$1.onResponse(SnapshotLifecycleTask.java:113)\n\tat org.elasticsearch.xpack.slm.SnapshotLifecycleTask$1.onResponse(SnapshotLifecycleTask.java:95)\n\tat 
  ..........
  IndexShardSnapshotFailedException[IllegalArgumentException[Unknown client name [secondary]. Existing client configs: default]]\n\t\tat 
  org.elasticsearch.snapshots.SnapshotShardFailure.<init>(SnapshotShardFailure.java:66)\n\t\tat 
  org.elasticsearch.snapshots.SnapshotShardFailure.<init>(SnapshotShardFailure.java:54)\n\t\tat =

从报错信息分析,某些分片无法识别GCS client : secondary , 首先把该分片查找出来。

获取备份阶段

# 先手工执行一次备份
POST _slm/policy/my-backup-slm/_execute

# 获取备份阶段状态 
GET _snapshot/_status

 "my_index" : {
          "shards_stats" : {
            "initializing" : 0,
            "started" : 0,
            "finalizing" : 0,
            "done" : 5,
            "failed" : 1,
            "total" : 6
          },
          "stats" : {
            "incremental" : {
              "file_count" : 0,
              "size_in_bytes" : 0
            },
            "total" : {
              "file_count" : 5,
              "size_in_bytes" : 1040
            },
            "start_time_in_millis" : 1658916212121,
            "time_in_millis" : 3523
          },
          "shards" : {
            "0" : {
              "stage" : "FAILURE",
              "stats" : {
                "incremental" : {
                  "file_count" : 0,
                  "size_in_bytes" : 0
                },
                "total" : {
                  "file_count" : 0,
                  "size_in_bytes" : 0
                },
                "start_time_in_millis" : 0,
                "time_in_millis" : 1658916211139
              },
              "reason" : "IllegalArgumentException[Unknown client name [secondary]. Existing client configs: default]"
            },
            "1" : {
              "stage" : "DONE",
              ......
            },
            "2" : {
              "stage" : "DONE",
              ......
            },
            "3" : {
             ......
            },
            "4" : {
              "stage" : "DONE",
             ......
            },
            "5" : {
              "stage" : "DONE",
              ......
            }
          }
        }

上面显示索引 “my_index”显示共有6个分片,其中分片0备份失败,原因是:Unknown client name [secondary].

检查分片所有节点IP

curl -XGET  "http://192.168.X.X:9200/_cat/shards/my_index/?pretty" 
# 部分信息用 * 号代替
.......
my_index 0 p STARTED 0 208b 192.168.X.X node_data_**
my_index 0 r STARTED 0 208b 192.168.X.X node_data_**
my_index 0 r STARTED 0 208b 192.168.X.X node_data_**

通过索引获取分片0的主节点IP地址 ~

重新生成keystore

cd /usr/local/elasticsearch

# 将你的json文件重新导入es
./bin/elasticsearch-keystore add-file gcs.client.secondary.credentials_file /your-path/your-key.json 

# 修改权限为es进程用户
chown elasticsearch:elasticsearch /usr/local/elasticsearch/config/elasticsearch.keystore

检查存储库

验证快照存储库是否可用

POST /_snapshot/my-backup-repository/_verify
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Ethanchen's notes

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

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

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

打赏作者

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

抵扣说明:

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

余额充值