什么是Elasticsearch 7.2.0的默认用户名和密码(启用X-pack时)



我做了config/elasticsearch.yml中的更改为

xpack.security.enabled: true

现在,在启动Elasticsearch(./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的默认用户名/密码是什么?

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

要设置密码,您可以使用以下任何一个命令:

bin/elasticsearch-setup-passwords interactive
bin/elasticsearch-setup-passwords auto

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

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

在此处阅读更多一个配置安全性的信息。

最新更新