官網https://www.elastic.co/cn/ 中文指南https://www.gitbook.com/book/chenryn/elk-stack-guide-cn/details ELK Stack (5.0版本以後) Elastic Stack == (ELK Stack + Beats) ELK Stack包含:ElasticSearch、Logstash、Kibana ElasticSearch是一個搜索引擎,用來搜索、分析、存儲日誌。它是分佈式的,也就是說能夠橫向擴容,能夠自動發現,索引自動分片,總之很強大。文檔https://www.elastic.co/guide/cn/elasticsearch/guide/current/index.html Logstash用來採集日誌,把日誌解析爲json格式交給ElasticSearch。 Kibana是一個數據可視化組件,把處理後的結果經過web界面展現 Beats在這裏是一個輕量級日誌採集器,其實Beats家族有5個成員 早期的ELK架構中使用Logstash收集、解析日誌,可是Logstash對內存、cpu、io等資源消耗比較高。相比 Logstash,Beats所佔系統的CPU和內存幾乎能夠忽略不計 x-pack對Elastic Stack提供了安全、警報、監控、報表、圖表於一身的擴展包,是收費的
準備三臺機器
主節點: 192.168.22.134
數據節點:192.168.22.135
數據節點:192.168.22.130html
https://www.elastic.co/guide/en/elastic-stack/current/installing-elastic-stack.html
如下操做3臺機器上都要執行 rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch vim /etc/yum.repos.d/elastic.repo //加入以下內容 [elasticsearch-6.x] name=Elasticsearch repository for 6.x packages baseurl=https://artifacts.elastic.co/packages/6.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=1 autorefresh=1 type=rpm-md yum install -y elasticsearch
直接下載rpm文件,而後安裝java
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.0.0.rpm rpm -ivh elasticsearch-6.0.0.rpm
elasticsearch配置文件/etc/elasticsearch和/etc/sysconfig/elasticsearch 參考https://www.elastic.co/guide/en/elasticsearch/reference/6.0/rpm.html 在134上編輯配置文件vi /etc/elasticsearch/elasticsearch.yml//增長或更改 cluster.name: aminglinux node.master: true//意思是該節點爲主節點 node.data: false network.host: 0.0.0.0 discovery.zen.ping.unicast.hosts: ["192.168.133.130", "192.168.133.132", "192.168.133.133"] 在135和130上一樣編輯配置文件 vi /etc/elasticsearch/elasticsearch.yml//增長或更改 cluster.name: aminglinux node.master: false node.data: true network.host: 0.0.0.0 discovery.zen.ping.unicast.hosts: ["192.168.133.130", "192.168.22.134", "192.168.22.135"]
134上執行 curl '192.168.22.134:9200/_cluster/health?pretty' 健康檢查 curl '192.168.22.134:9200/_cluster/state?pretty' 集羣詳細信息 參考 http://zhaoyanblog.com/archives/732.html
如下在134上執行 前面已經配置過yum源,這裏就不用再配置了 yum install -y kibana 若速度太慢,能夠直接下載rpm包 wget https://artifacts.elastic.co/downloads/kibana/kibana-6.0.0-x86_64.rpm rpm -ivh kibana-6.0.0-x86_64.rpm kibana一樣也須要安裝x-pack(可省略) 安裝方法同elasticsearch的x-pack cd /usr/share/kibana/bin (可省略) ./kibana-plugin install x-pack //若是這樣安裝比較慢,也能夠下載zip文件(可省略) wget https://artifacts.elastic.co/downloads/packs/x-pack/x-pack-6.0.0.zip//這個文件和前面下載的那個實際上是一個(可省略) ./kibana-plugin install file:///tmp/x-pack-6.0.0.zip (可省略)