感謝此老兄:《手把手教你搭建一個 Elasticsearch 集羣》html
前提準備node
安裝kibana-6.7.0: 《Elasticsearch-6.7.0系列(三)5601端口 kibana——ES的UI界面》linux
升級前ES的licensevim
升級以前訪問:http://192.168.10.110:9200/_xpack 其中security一項內容以下:elasticsearch
security description "Security for the Elastic Stack" available false enabled true
在kibana中升級licensespa
在 Kibana 中訪問 Management -> Elasticsearch -> License Management,點擊右側的升級 License 按鈕,能夠免費試用 30 天的高級 License,升級完成以後kibana頁面會顯示以下:3d
修改ES配置文件code
elasticsearch-6.7.0/config/elasticsearch.yml 添加以下配置:htm
xpack.security.enabled: true xpack.ml.enabled: true xpack.license.self_generated.type: trial //表示試用的意思
設置集羣密碼blog
./bin/elasticsearch-setup-passwords interactive 設置集羣密碼:
總共修改了6個用戶的密碼:elastic、kibana、apm_system、logstash_system、beats_system、remote_monitoring_user。
修改kibana配置文件
vim kibana-6.7.0-linux-x86_64/config/kibana.yml,設置正確的ES訪問用戶名密碼:
elasticsearch.username: "elastic" elasticsearch.password: "123456"
修改配置以後,記得重啓ES!!! 以及,kibana!!!
ES啓動時,license信息由原來的:
[2019-06-08T07:11:26,598][INFO ][o.e.l.LicenseService ] [MiIzYdB] license [33b7d4ab-ee0c-4a48-9f18-30c9e11ec47a] mode [basic] - valid
變爲trial試用期:
019-06-08T04:12:13,998][INFO ][o.e.l.LicenseService ] [node-130] license [cf9606b3-5e36-4fdd-9469-587ddb323a62] mode [trial] - valid
ES集羣訪問使用密碼
再訪問http://192.168.10.110:9200/_xpack 其中security一項內容以下:
security description "Security for the Elastic Stack" available true //已經從false變爲true了,表示security設置成功 enabled true
此時訪問ES: http://192.168.10.110:9200 須要用戶名和密碼了:
訪問kibana: http://192.168.10.110:5601 也須要用戶名密碼了:
PS:記住這個license只有30天試用期,時間到了以後要麼購買,要麼從新安裝ES(網上說重裝可行)。