1. 程式人生 > >kibana5.3使用x-pack外掛對elasticsearch5.3叢集進行監控

kibana5.3使用x-pack外掛對elasticsearch5.3叢集進行監控

需求:  安裝elasticsearch後新增x-pack外掛,訪問elasticsearch索引可以不用使用者驗證;並且能在kibana的頁面上檢視monitor模組

說明:由於只是一次解決問題經歷,有什麼不對的請大佬們指點

解決:

環境: centos (windows使用者只需要下載相應的zip包解壓即可 地址https://www.elastic.co/downloads/past-releases)

1: 安裝elasticsearch

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.3.0.tar.gz

tar -zxvf  elasticsearch-5.3.0.tar.gz

cd elasticsearch-5.3.0

2:安裝Elasticsearch外掛 X-Pack  
bin/elasticsearch-plugin install x-pack

3: 啟動Elasticsearc 

bin/elasticsearch -d

/**
預設 ElasticSearch的使用者:
username:elastic
password:changeme
**/


4: 新建一個特殊的使用者,有monitor檢視許可權
--新增角色許可權
curl -XPOST -u elastic:changeme 'localhsot:9200/_xpack/security/role/monitor_admin' -d '{
  "indices" : [
    {
      "names" : [ "events*" ],
      "privileges" : [ "all" ]
    },
    {
      "names" : [ ".kibana*" ],
      "privileges" : [ "manage", "read", "index" ]
    }
  ]
}'

--新增使用者並賦予角色許可權
curl -XPOST -u elastic:changeme 'localhsot:9200/_xpack/security/user/monitor' -d '{
  "password" : "monitor",
  "full_name" : "monitor",
  "email" : "
[email protected]
",
  "roles" : [ "events_admin" ]
}'


5: 停止 elasticsearch
pid=$(ps -ef |egrep -v grep | grep elasticsearch | awk '{ print $2}')

kill -9  $pid

6: 在config/elasticsearch.yml中新增如下配置,去除許可權kongzhi

xpack.security.enabled: false

--重啟es

bin/elasticsearch -d


7:安裝kibana

wget https://artifacts.elastic.co/downloads/kibana/kibana-5.3.0-linux-x86_64.tar.gz

tar -zxvf  kibana-5.3.0-linux-x86_64.tar.gz

cd kibana-5.3.0-linux-x86_64

8: 安裝Kibana的X-Pack 外掛
bin/kibana-plugin install x-pack

9:把特殊許可權的使用者新增到kibana.yml作為預設登入使用者 
xpack.security.enabled: false
elasticsearch.username: "monitor"
elasticsearch.password: "monitor"
elasticsearch.url: "http://localhost:9200"
server.host: "localhost"
server.name: "localhost"

# elasticsearch.url : the remote elasticsearch server 
# elasticsearch.username and elasticsearch.password :  the login user
# server.host : use this ip to login in
# xpack.security.enabled : close security module


10: login in kibana 

http://localhost:5601  

效果圖:es叢集,新的節點只需要把第一份es檔案拷貝一份並去掉data檔案,再設定node節點與第一個節點不一樣再啟動就可以看到叢集效果