0x01 缘由
最近,比较蛋疼,产品在公司战略层面上已经开始远离,但是外场又有项目。因为现网运行环境elasticsearch的不稳定性,最近尝试安装了head、hq、bigdesk、kibana、x-pack去监控线上es运行情况。不管效果咋样吧,先说下安装的心路历程。
0x02 安装步骤
建议相关安装步骤从官方帮助文档中获取,在网上查阅的安装办法千差万别,容易走上弯路。
1.安装es
这个过程网上有很多教程,相对较简单。关键是配置项。此次安装示例为elasticsearc 5.1.1
2.安装kibana
kibana是一个为 ElasticSearch 提供的数据分析的 Web 接口。可使用它对日志进行高效的搜索、可视化、分析等各种操作。
2.1下载与es对应的版本
wget https://artifacts.elastic.co/downloads/kibana/kibana-5.1.1-linux-x86_64.tar.gz
sha1sum kibana-5.1.1-linux-x86_64.tar.gz
tar -xzf kibana-5.1.1-linux-x86_64.tar.gz
cd kibana/
2.2相关配置
cd kibana-5.1.1-linux-x86_64/config
vim kibana.yml
配置关键点:
2.3验证是否安装成功
http://localhost:5601/,可以打开Kibana,此时需要输入用户名和密码登录,默认分别是 elastic 和 changeme。
2.4 需要关联索引
在下图箭头出添加你的索引命名:可以带通配符*
现在基本kibana就安装完成了。
3.安装x-pack
3.1 此处完全参考官方教程:https://www.elastic.co/guide/en/x-pack/current/monitoring-cluster.html
1.Install X-Pack into Kibana.
bin/kibana-plugin install x-pack
2.Configure Kibana
3.Start Kibana by running bin/kibana.
4.Install X-Pack on the Elasticsearch nodes in your production cluster.
bin/elasticsearch-plugin install x-pack
Configure each Elasticsearch node in the cluster you are monitoring to send metrics to your monitoring cluster by configuring an HTTP exporter in the xpack.monitoring.exporters settings in elasticsearch.yml.
xpack.monitoring.exporters:
id1:
type: http
host: ["http://es-mon-1:9200", "http://es-mon2:9200"]
auth.username: remote_monitor
auth.password: changeme
5.Restart Elasticsearch on the nodes in your production cluster.
3.2 申请license
简单填写相关信息,然后会将相关信息发到邮箱。
3.3 安装license
curl -XPUT -u elastic 'http://<host>:<port>/_xpack/license' -H "Content-Type: application/json" -d @license.json
-u elastic 内置的超级用户,默认密码是changeme.
<host> Es IP
<port> Http 端口
license.json 申请网站下下载的
0x03 使用
kibana + x-pack后多了一个监控界面,如下图:
bigdesk使用和HQ使用类似:
0x04 总结
无论是开源程序,还是自己编写的服务,有一个好的监控工具,是保证产品在线上运行稳定的必备工具。