1

我试图理解为什么我得到 401。

采取的步骤:

  • 创建了一个 elasticsearch.keystore
  • 添加bootstrap.password成功,与cat ~/.elk.secret | /opt/elasticsearch/bin/elasticsearch-keystore add -x 'bootstrap.password'
  • 由于我有多个实例正在运行,我它移动到新的 conf 目录中

但现在我得到 401:

 curl -X GET 'https://elastic:myFancyPass@myServer:9200/_cluster/health?pretty' -k
{
  "error" : {
    "root_cause" : [
      {
        "type" : "security_exception",
        "reason" : "unable to authenticate user [elastic] for REST request [/_cluster/health?pretty]",
        "header" : {
          "WWW-Authenticate" : [
            "Bearer realm=\"security\"",
            "ApiKey",
            "Basic realm=\"security\" charset=\"UTF-8\""
          ]
        }
      }
    ],
    "type" : "security_exception",
    "reason" : "unable to authenticate user [elastic] for REST request [/_cluster/health?pretty]",
    "header" : {
      "WWW-Authenticate" : [
        "Bearer realm=\"security\"",
        "ApiKey",
        "Basic realm=\"security\" charset=\"UTF-8\""
      ]
    }
  },
  "status" : 401
}

我的理解是这个错误可能是由两件事引起的:

  • 密码错误(我怀疑这是我的情况)
  • 错误的elasticsearch.file

如何找到它正在加载的 elasticsearch.keystore

跑步rootLogger.level = debug没有帮助。我觉得得到确认会很棒,例如/opt/elasticsearch/instance2/conf/elasticsearch.keystore

4

0 回答 0