Elasticsearch:未知的s3存储库

时间:2017-01-18 12:40:49

标签: elasticsearch

我正在尝试配置我的dockerized elasticsearch:2.4,以便能够为我的索引创建快照。

首先,我安装了cloud-aws插件:

docker exec -it es plugin install cloud-aws

然后,我正在尝试设置我的存储库:

docker exec -it es curl -XPUT 'http://localhost:9200/_snapshot/s3' -d '
{
  "type": "s3",
  "settings": {
    "bucket": "es-backup-living",
    "region": "eu-central-1",
    "access_key": "-----",
    "secret_key": "-----"
  }
}
'

尽管如此,我从elasticsearch收到了这条消息:

{
  "error" : {
    "root_cause" : [ {
      "type" : "repository_exception",
      "reason" : "[s3] failed to create repository"
    } ],
    "type" : "repository_exception",
    "reason" : "[s3] failed to create repository",
    "caused_by" : {
      "type" : "illegal_argument_exception",
      "reason" : "Unknown [repository] type [s3]"
    }
  },
  "status" : 500
}

有什么想法吗?

修改

安装cloud-aws后,我试图获取插件列表:

#docker exec -it es curl -XGET 'http://localhost:9200/_cat/plugins?v'
name component version type url

如您所见,列表为空。

重启我的dockerized elasticsearch后,插件列表保持为空。

#docker stop es && docker start es
#docker exec -it es curl -XGET 'http://localhost:9200/_cat/plugins?v'
name component version type url

修改

我在dockerfile上添加了插件添加:

RUN /usr/share/elasticsearch/bin/plugin install --batch cloud-aws

一旦安装完毕,我会收到另一条消息:

{
  "error" : {
    "root_cause" : [ {
      "type" : "repository_verification_exception",
      "reason" : "[s3] path  is not accessible on master node"
    } ],
    "type" : "repository_verification_exception",
    "reason" : "[s3] path  is not accessible on master node",
    "caused_by" : {
      "type" : "i_o_exception",
      "reason" : "Unable to upload object tests-9SGwQ4I-Tj6iLEr_fG5Qgw/master.dat-temp",
      "caused_by" : {
        "type" : "amazon_s3_exception",
        "reason" : "Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: 90B3CC8F3BDFE716)"
      }
    }
  },
  "status" : 500
}

我在AWS上添加了一个用户授予此策略的用户:

{
    "Statement": [
        {
            "Action": [
                "s3:ListBucket",
                "s3:GetBucketLocation",
                "s3:ListBucketMultipartUploads",
                "s3:ListBucketVersions"
            ],
            "Effect": "Allow",
            "Resource": [
                "arn:aws:s3:::snaps.example.com"
            ]
        },
        {
            "Action": [
                "s3:GetObject",
                "s3:PutObject",
                "s3:DeleteObject",
                "s3:AbortMultipartUpload",
                "s3:ListMultipartUploadParts"
            ],
            "Effect": "Allow",
            "Resource": [
                "arn:aws:s3:::snaps.example.com/*"
            ]
        }
    ],
    "Version": "2012-10-17"
}

有什么想法吗?

1 个答案:

答案 0 :(得分:2)

你没告诉你的版本是什么。

请注意,从5.0开始,您必须使用repository-s3插件。

跑完后:

docker exec -it es plugin install cloud-aws

你重启了elasticsearch吗?

您需要重新启动它。看看GET _cat/plugins?v也是如此。 确保它已安装在所有节点上。