|
ELKStack简介
对于日志系统来说,常见的需求就是收集、存储、查询、展示,而ELKStack就是这样一个日志系统。
ELKStack是Elasticsearch、Logstash、Kibana技术栈的结合,它的通用架构如下图所示:
Elasticsearch部署
安装Elasticsearch和LogStash需要Java环境,所以需要提前安装好JDK,可以直接使用yum安装。也可以从Oracle官网下载JDK进行安装??贾耙繁DK正常安装并且环境变量也配置正确:
0.安装JDK
[[email protected] ~]# yum install -y java
[[email protected] ~]# java -version
openjdk version "1.8.0_65"
OpenJDK Runtime Environment (build 1.8.0_65-b17)
OpenJDK 64-Bit Server VM (build 25.65-b01, mixed mode)
1.下载并安装GPG key
rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
2.添加yum仓库
cat >/etc/yum.repos.d/elasticsearch.repo<<eof
[elasticsearch-2.x]
name=Elasticsearch repository for 2.x packages
baseurl=//packages.elastic.co/elasticsearch/2.x/centos
gpgcheck=1
gpgkey=//packages.elastic.co/GPG-KEY-elasticsearch
enabled=1
EOF
cat >/etc/yum.repos.d/logstash.repo<<eof
[logstash-2.3]
name=Logstash repository for 2.3.x packages
baseurl=https://packages.elastic.co/logstash/2.3/centos
gpgcheck=1
gpgkey=https://packages.elastic.co/GPG-KEY-elasticsearch
enabled=1
EOF
cat >/etc/yum.repos.d/kibana.repo<<eof
[kibana-4.5]
name=Kibana repository for 4.5.x packages
baseurl=//packages.elastic.co/kibana/4.5/centos
gpgcheck=1
gpgkey=//packages.elastic.co/GPG-KEY-elasticsearch
enabled=1
EOF
3.安装elasticsearch、logstash、kibana
yum install -y elasticsearch logstash kibana
安装插件
/usr/share/elasticsearch/bin/plugin install mobz/elasticsearch-head
/usr/share/elasticsearch/bin/plugin install lmenezes/elasticsearch-kopf
[[email protected] plugins]# pwd
/usr/share/elasticsearch/plugins
[[email protected] plugins]# ls
head kopf
启动服务:
/etc/init.d/elasticsearch start
/etc/init.d/kibana start
浏览器访问:
//IP:9200/_plugin/head
//IP:9200/_plugin/kopf
//IP:5601
总结:
Logstash用于收集/发送日志,收集/发送日志的配置文件放置在 /etc/logstash/conf.d/ 下。
Elasticsearch用于存储和查询logstash收集的日志,服务端口为tcp:9200,
elasticsearch的插件放置在 /usr/share/elasticsearch/bin/plugin 下。
Kibana用于在web界面展示elasticsearch存储和查询的日志信息,服务端口为tcp:5601,
只需修改配置文件/opt/kibana/config/kibana.yml,使其与elasticsearch联动即可。
</eof
</eof
|
+1
0
|