es配置用戶認(rèn)證

es版本:6.3.2

查看許可狀態(tài)



可以看到是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,然后執(zhí)行.\elasticsearch-setup-passwords.bat interactive設(shè)置密碼。
如果沒加xpack的配置,直接設(shè)置密碼會報錯,如下:

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.

執(zhí)行.\curl.exe http://<host>:<port>測試連接,報錯,連接失敗。
然后再執(zhí)行.\curl.exe http://<host>:<port> -u elastic:<password>連接成功。
或者也可以直接瀏覽器訪問http://<host>:<port>驗證結(jié)果。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容