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>验证结果。
网友评论