ElasticSearch 7.2.0的默认用户名和密码是什么(启用x-pack时)?

时间:2019-07-08 20:09:07

标签: elasticsearch elastic-stack

我将config/elasticsearch.yml更改为

xpack.security.enabled: true

现在开始弹性搜索(./bin/elasticsearch)之后,然后执行以下操作: curl localhost:9200

获取:

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

然后尝试了这些2:

curl localhost:9200 -u elastic:elastic
curl localhost:9200 -u elastic:changeme

获取:

{"error":{"root_cause":[{"type":"security_exception","reason":"failed to authenticate user [elastic]",
"header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}], "type":"security_exception", "reason":"failed to authenticate user [elastic]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}},"status":401}%

Elasticsearch 7.2.0的默认用户名/密码是什么?

1 个答案:

答案 0 :(得分:0)

您需要使用elasticsearch-setup-passwords util为内置Elastic的用户生成/设置密码。

要设置密码,可以使用以下命令之一:

bin/elasticsearch-setup-passwords interactive

bin/elasticsearch-setup-passwords auto

interactive参数为用户提示新密码,而auto为您生成密码。

elastic用户是弹性集群的超级用户。

了解更多有关配置安全性here的信息。