elasticsearch 5.0 s3存储库注册错误

时间:2016-12-14 09:00:24

标签: amazon-web-services elasticsearch amazon-s3

我要去弹性恢复。 当使用2.x版本时,s3存储库寄存器很适合脚本。

curl -XPUT 'http://'ip':9200/_snapshot/'repo_2016-12-14/?pretty'' -d '
{"type": "s3",
"settings":
{ "bucket": "'patch-backup'",
"base_path" : "elasticsearch/'2016-12-14'",
"region": "ap-southeast-1",
"access_key": "************",
"secret_key": "*************"
}}'

但升级到5.0版时, 上面的脚本没有操作。并显示此错误

{"error" : {
"root_cause" : [
{
"type" : "repository_exception",
"reason" : "[repo_2016-12-14] repository type [s3] does not exist"
}
],
"type" : "repository_exception",
"reason" : "[repo_2016-12-14] repository type [s3] does not exist"
},
"status" : 500
}
-

3 个答案:

答案 0 :(得分:9)

您需要在所有群集节点中安装repository-s3插件,然后重新启动节点。否则插件无法使用。

答案 1 :(得分:1)

动机:您需要将您的 elasticserach 数据快照备份到 aws s3 服务中,但是您收到一个错误,导致您无法连接到弹性存储库。

解决方案:您需要确保您的 repository-s3 插件已安装在所有集群节点上(安装并在 之后重新启动服务)。之后注册手动快照仓库并备份数据。

例如 - 假设您有 3 个节点运行 elasticsearch docker:

- elastic-cluster-node-a
- elastic-cluster-node-b
- elastic-cluster-node-c

1.在所有节点上你应该安装正确的插件:

#!connect to cluster node: ( for each a b and c)
 ssh -At <bastion-gw> ssh elastic-cluster-node-<node-number>

#!connect to elastic container:
docker exec -it <your-container-id> /bin/bash

#!install plugin
bin/elasticsearch-plugin install repository-s3

#!restart service
docker-compose restart elasticsearch

2.验证您的插件是否正确安装在集群上:

curl -X GET http://<your-cluster-host>:9200/_nodes?filter_path=nodes.*.plugins

3.现在您应该在 s3 上注册一个手动快照:

curl -XPUT <your-cluster-host>/_snapshot/my-snapshot-repo-name \
-H 'Content-Type: application/json' \
-d @- <<'EOF'
{
  "type": "s3",
  "settings": {
    "bucket": "s3-bucket-name",
    "region": "region",
    "role_arn": "arn:aws:iam::123456789012:role/TheSnapshotRole"
  }
}
EOF

4.备份您的数据:

curl -XPUT '<your-cluster-host>/_snapshot/repository/snapshot-name'

欲了解更多信息,请查看 aws doc

答案 2 :(得分:0)

我遇到了同样的问题。我的错误只是在数据节点上安装插件,而不是按照说明在群集中的每个节点上安装。一旦我在主节点上安装了插件,这也有效。