如何解决ElasticSearch登录问题?

ve7v8dk2  于 2023-04-20  发布在  ElasticSearch
关注(0)|答案(2)|浏览(378)

我正在尝试在我的Mac上安装ElasticSearch。
我从official website下载了tar并将其解压缩。
然后我运行bin/elastic。之后我打开https://localhost:9200/,当我取消它时,它会显示用户名和密码的输入字段,这会出现:

{
  "error": {
    "root_cause": [
      {
        "type": "security_exception",
        "reason": "missing authentication credentials for REST request [/]",
        "header": {
          "WWW-Authenticate": [
            "Basic realm=\"security\" charset=\"UTF-8\"",
            "Bearer realm=\"security\"",
            "ApiKey"
          ]
        }
      }
    ],
    "type": "security_exception",
    "reason": "missing authentication credentials for REST request [/]",
    "header": {
      "WWW-Authenticate": [
        "Basic realm=\"security\" charset=\"UTF-8\"",
        "Bearer realm=\"security\"",
        "ApiKey"
      ]
    }
  },
  "status": 401
}

我没有输入密码或用户名,我看了前面的问题,没有人为我工作。我该怎么办?
注意:当我打开http://localhost:9200/时,它显示:

This page isn’t working localhost didn’t send any data.
ERR_EMPTY_RESPONSE
nwnhqdif

nwnhqdif1#

Tldr;

Elasticsearch似乎会自动创建密码。
你可能想把你自己的

bin/elasticsearch-setup-passwords interactive

但在8.x及更高版本中,它已被弃用。
你应该用

elasticsearch-setup-passwords interactive
hkmswyz6

hkmswyz62#

如果Elastic Search安装程序在Windows上,那么我遵循以下步骤来解决身份验证问题
1.以管理员身份打开命令提示符
1.转到Elastic搜索解压缩文件夹bin路径cd elasticsearch-bin-folderpath

  1. bin>elasticsearch-users useradd username -p password -r superuser
  2. bin>elasticsearch
    在浏览器中打开https:localhost:9200/
    当提示输入用户名和密码时给予useradd命令后设置的用户名和密码

相关问题