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

Joe*_*Joe 3 elasticsearch elastic-stack

我的确在变化config/elasticsearch.yml,以

xpack.security.enabled: true
Run Code Online (Sandbox Code Playgroud)

现在在启动 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}
Run Code Online (Sandbox Code Playgroud)

然后尝试了这两个:

curl localhost:9200 -u elastic:elastic
curl localhost:9200 -u elastic:changeme
Run Code Online (Sandbox Code Playgroud)

得到:

{"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}%
Run Code Online (Sandbox Code Playgroud)

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

Nis*_*ini 5

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

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

bin/elasticsearch-setup-passwords interactive

bin/elasticsearch-setup-passwords auto
Run Code Online (Sandbox Code Playgroud)

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

elastic user 是 elastic-cluster 的超级用户。

在此处阅读更多配置安全性。