无法使用基本身份验证从url存储库还原快照

nbysray5  于 2021-06-15  发布在  ElasticSearch
关注(0)|答案(0)|浏览(287)

问题:

我正在尝试在es示例es1上创建快照,并还原到另一个示例es2。当远程url需要基本身份验证时,它无法还原。
es版本:6.5.4

成功与失败案例:

成功案例:当公开es1存储库文件夹的网站向internet打开(没有身份验证)时,列表/还原工作正常。例如,当回购url为“http://snapshots.example-server.com"
失败案例:当我向同一个url添加基本身份验证时,它不起作用。例如,当回购url为:http://username:password@snapshots.example-server.com"
当我尝试使用基本身份验证在url存储库中列出快照时,得到的错误是:

{
  "error": {
    "root_cause": [
      {
        "type": "repository_exception",
        "reason": "[remote-repo] could not read repository data from index blob"
      }
    ],
    "type": "repository_exception",
    "reason": "[remote-repo] could not read repository data from index blob",
    "caused_by": {
      "type": "i_o_exception",
      "reason": "Server returned HTTP response code: 401 for URL: http://username:password@snapshots.example-server.com/index.latest"
    }
  },
  "status": 500
}

设置:

设置es1:
第一步:修改配置文件:

path.repo: ["/path/to/es1_repo"]

第2步:创建回购:

PUT /_snapshot/es1_repo
{
  "type": "fs",
  "settings": {
    "location": "/path/to/es1_repo"
  }
}

步骤3:使存储库路径可从internet访问:我在es1机器上设置了一个nginx服务器,以公开 "/path/to/es1_repo” 目录列表,例如:http://snapshots.example-server.com. 它已启用基本身份验证。例如,您可以通过以下方式访问回购:http://username:password@snapshots.example-server.com and 您将看到目录列表。
步骤4:创建快照:

PUT /_snapshot/es1_repo/snapshot_1?wait_for_completion=true
{
  "indices": "the_index_name",
  "ignore_unavailable": true,
  "include_global_state": false
}

设置es2:
步骤5:添加到弹性配置:

repositories.url.allowed_urls: "http://username:password@snapshots.example-server.com"

第六步:注册回购

PUT _snapshot/remote-repo
{
   "type": "url",
   "settings": {
       "url": "http://username:password@snapshots.example-server.com"
   }
}

步骤7:检查快照是否可访问:

GET _snapshot/remote-repo/_all

在这一步中,将出现粘贴在顶部的错误。如果我禁用基本身份验证,它可以正常工作。
有什么问题吗?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题