elasticsearch - 如何为elasticsearch用户设置密码?

标签 elasticsearch

我正在尝试为我的 ES 云启用安全性。我正在遵循以下说明:

https://www.elastic.co/guide/en/elasticsearch/reference/7.5/configuring-security.html

我被困在第 6 点。当我尝试运行 bin/elasticsearch-setup-passwords interactive 时出现错误:

Failed to determine the health of the cluster running at http://XXX:9200
Unexpected response code [503] from calling GET http://XXX:9200/_cluster/health?pretty
Cause: master_not_discovered_exception

It is recommended that you resolve the issues with your cluster before running elasticsearch-setup-passwords.
It is very likely that the password changes will fail when run against an unhealthy cluster.

Do you want to continue with the password setup process [y/N]

我尝试检查我的 ES 实例状态:
curl http://XXX:9200/_cluster/health?pretty

并得到
{
  "error" : {
    "root_cause" : [
      {
        "type" : "security_exception",
        "reason" : "missing authentication credentials for REST request [/_cluster/health?pretty]",
        "header" : {
          "WWW-Authenticate" : "Basic realm=\"security\" charset=\"UTF-8\""
        }
      }
    ],
    "type" : "security_exception",
    "reason" : "missing authentication credentials for REST request [/_cluster/health?pretty]",
    "header" : {
      "WWW-Authenticate" : "Basic realm=\"security\" charset=\"UTF-8\""
    }
  },
  "status" : 401
}

所以,看起来我无法设置密码,因为我无法进行身份验证:)?

最佳答案

这是为 Elasticsearch 设置安全性的官方 doc
步骤1:cd /usr/share/elasticsearch/第2步:

sudo bin/elasticsearch-setup-passwords auto

         
或者
sudo bin/elasticsearch-setup-passwords interactive

auto - Uses randomly generated passwords interactive - Uses passwords entered by a user


以上命令可以帮助您设置密码

关于elasticsearch - 如何为elasticsearch用户设置密码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59644348/

相关文章:

elasticsearch - elasticsearch得分max_score = -1

c# - ElasticSearch NEST C#-如何使用注释设置数字格式模式?

Elasticsearch 批量 API - 索引与创建/更新

java - 用于 ElasticSearch 的 Spring Boot Micrometer 与 APM Java 代理

search - 根据嵌套字段值修改elasticsearch分数

docker - 如何从容器(API)连接到容器(elasticsearch)?

docker - 推送自己的id。 Confluent kafka 连接 elasticsearch docker

facebook-graph-api - facebook react 将按 aggs 术语 elasticsearch 分组

docker - 使用Kubernetes进行Elastic Search设置

mysql - elastic search + couchdb 或 sphinx + mysql .... 用于文档审查 SaaS