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

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

问题:

我正在尝试在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存储库中列出快照时,得到的错误是:

  1. {
  2. "error": {
  3. "root_cause": [
  4. {
  5. "type": "repository_exception",
  6. "reason": "[remote-repo] could not read repository data from index blob"
  7. }
  8. ],
  9. "type": "repository_exception",
  10. "reason": "[remote-repo] could not read repository data from index blob",
  11. "caused_by": {
  12. "type": "i_o_exception",
  13. "reason": "Server returned HTTP response code: 401 for URL: http://username:password@snapshots.example-server.com/index.latest"
  14. }
  15. },
  16. "status": 500
  17. }

设置:

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

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

第2步:创建回购:

  1. PUT /_snapshot/es1_repo
  2. {
  3. "type": "fs",
  4. "settings": {
  5. "location": "/path/to/es1_repo"
  6. }
  7. }

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

  1. PUT /_snapshot/es1_repo/snapshot_1?wait_for_completion=true
  2. {
  3. "indices": "the_index_name",
  4. "ignore_unavailable": true,
  5. "include_global_state": false
  6. }

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

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

第六步:注册回购

  1. PUT _snapshot/remote-repo
  2. {
  3. "type": "url",
  4. "settings": {
  5. "url": "http://username:password@snapshots.example-server.com"
  6. }
  7. }

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

  1. GET _snapshot/remote-repo/_all

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

暂无答案!

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

相关问题