注:本文使用的為elastic 8.0
此版本可能還不穩定,對比7.x版本,有很多默認配置發生變化,舊版本的流程不完全適用於新版本
1、報錯:received plaintext http traffic on an https channel, closing connection Netty4HttpChannel
轉載:https://www.cfanz.cn/resource/detail/oXwkjoomAxVLQ
是因為開啟了 ssl 認證。
在 ES/config/elasticsearch.yml 文件中把 xpack.security.http.ssl:enabled 設置成false即可
2、localhost:9200 需要用戶名密碼
首次執行 ./bin/elasticsearch 時,終端會顯示如下界面(如果沒有顯示,請到 https://www.elastic.co/cn/start 重新下載安裝包)
3、kibana服務啟動報錯
[ERROR][elasticsearch-service] Unable to retrieve version information from Elasticsearch nodes. security_exception: [security_exception] Reason: missing authentication credentials for REST request [/_nodes?filter_path=nodes.*.version%2Cnodes.*.http.publish_address%2Cnodes.*.ip]
原因:yml文件中沒有配置kibana的用戶名和密碼
但是8.0版本中,elasticsearch.yml 中 xpack.security.enabled 默認值為true,第一次啟動會自動生成 elastic 用戶的密碼,而沒有其他 build-in 的密碼。
直接執行 ./bin/elasticsearch-setup-passwords 則會報錯。
解決方案如下:
1、修改配置文件config/elasticsearch.yml,xpack.security.enabled 改為 false
2、重啟elasticsearch服務
3、執行命令,刪除密碼相關索引
curl -XDELETE 127.0.0.1:9200/.security-7
執行成功會出現如下打印:
{"acknowledged":true}
4、修改配置文件config/elasticsearch.yml,xpack.security.enabled 改為 true
5、重啟elasticsearch服務
6、執行命令,設置全部 build-in 的密碼(執行時發現此腳本已經標注為 deprecated,后續可能會刪除,目前仍可使用)
./bin/elasticsearch-setup-passwords
7、修改配置文件config/kibana.yml
elasticsearch.username: "kibana_system"
elasticsearch.password: "password"
8、啟動kibana,瀏覽器輸入 localhost:5601,使用elastic用戶名密碼登錄
4、mac es啟動報錯 Exception in thread “main“ java.nio.file.NotDirectoryException
到plugins路徑下,執行:
rm -rf .DS_STORE