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-Packbin/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" : "monitor@163.com",
"roles" : [ "events_admin" ]
}'
5: 停止 elasticsearch
pid=$(ps -ef |egrep -v grep | grep elasticsearch | awk '{ print $2}')
kill -9 $pid
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节点与第一个节点不一样再启动就可以看到集群效果