es配置用户认证

es版本:6.3.2

查看许可状态



可以看到是basic,需要启用 trial license

curl -H "Content-Type:application/json" -XPOST  http://<host>:<port>/_xpack/license/start_trial?acknowledge=true

然后在elasticsearch.yml文件中增加如下配置:

http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type
xpack.security.enabled: true

重启es,然后执行.\elasticsearch-setup-passwords.bat interactive设置密码。
如果没加xpack的配置,直接设置密码会报错,如下:

Unexpected response code [403] from calling GET http://*.*.*.*:9200/_xpack/security/_authenticate?pretty
It doesn't look like the X-Pack security feature is available on this Elasticsearch node.
Please check if you have installed a license that allows access to X-Pack Security feature.

ERROR: X-Pack Security is not available.

执行.\curl.exe http://<host>:<port>测试连接,报错,连接失败。
然后再执行.\curl.exe http://<host>:<port> -u elastic:<password>连接成功。
或者也可以直接浏览器访问http://<host>:<port>验证结果。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容