EBK(Elasticsearch、Beats、Kibana)是目前新兴的日志分析平台软件,本教程以centos6为例,给大家简单描述下该平台的搭建过程。本次示例中,服务端IP:192.168.1.107,客户端IP:192.168.1.108
服务器安装过程:
Elasticsearch
导入GPG key:
rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
vim /etc/yum.repos.d/elasticsearch.repo
[elasticsearch-2.x] name=Elasticsearch repository for 2.x packages baseurl=https://packages.elastic.co/elasticsearch/2.x/centos gpgcheck=1 gpgkey=https://packages.elastic.co/GPG-KEY-elasticsearch enabled=1
Elasticsearch运行需要jdk,所以必须先安装jdk
yum install java-1.8.0-openjdk
再安装Elasticsearch
yum install elasticsearch
运行elasticsearch
service elasticsearch start
加入开机启动
chkconfig elasticsearch on
Kibana我们也安装再服务端:
vim /etc/yum.repos.d/kibana.repo
[kibana-4.5] name=Kibana repository for 4.5.x packages baseurl=http://packages.elastic.co/kibana/4.5/centos gpgcheck=1 gpgkey=http://packages.elastic.co/GPG-KEY-elasticsearch enabled=1
安装kibana
yum install kibana
启动kibana
service kibana start
加入开机启动
chkconfig kibana on
把kibana默认的5601和elasticsearch的9200端口加入防火墙
iptables -I INPUT -p tcp --dport 5601 -j ACCEPT service iptables save
重启iptables
service iptables restart
此时,可以通过浏览器打开
http://192.168.1.107:5601 访问kibana的面板了,首先就是要添加索引的样式。
在客户端上安装beats,以filebeat为例
先安装GPGkey
rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
vim /etc/yum.repos.d/beats.repo
[beats] name=Elastic Beats Repository baseurl=https://packages.elastic.co/beats/yum/el/$basearch enabled=1 gpgkey=https://packages.elastic.co/GPG-KEY-elasticsearch gpgcheck=1
以安装filebeat为例:
yum install filebeat
加入开机启动
chkconfig --add filebeat
启动程序
service filebeat start
注意把filebeat的配置改下,制定elasticsearch的地址
output: elasticsearch: hosts: ["192.168.1.107:9200"]
导入beats面板
curl -L -O http://download.elastic.co/beats/dashboards/beats-dashboards-1.2.0.zip unzip beats-dashboards-1.2.0.zip cd beats-dashboards-1.2.0/ ./load.sh -url http://192.168.1.107:9200
vim /opt/kibana/config/kibana.yml
server.port: 5601 server.host: "192.168.1.107" elasticsearch.url: "http://192.168.1.107:9200"
vim /etc/elasticsearch/elasticsearch.yml
path.data: /path/to/data path.logs: /path/to/logs network.host: 192.168.1.107 http.port: 9200
重启elasticsearch和kibana服务
EBK(Elasticsearch,Beats,Kibana)安装教程