elk5.x環境搭建與常用插件安裝
ELK 5.X 環境搭建與常用插件安裝
環境介紹:
ip: 192.168.250.131
os: CentOS 7.1.1503 (Core)
內存不要給的太低,至少4G吧,否則elasticsearch啟動會報錯。
軟件及其版本 這裏軟件包都解壓在了/opt下,註意!
logstash-5.4.0.tar.gz
elasticsearch-5.4.0.tar.gz
kibana-5.4.0-linux-x86_64.tar.gz
jdk-8u92-linux-x64.tar.gz
安裝前準備:
(把jdk1.8以下的都要卸載掉,否則elasticsearch會報錯的)
cat /etc/profile 添加以下內容
export jdk=/opt/jdk
export PATH=$jdk/bin:$PATH
export elasticsearch=/opt/elasticsearch
export PATH=$elasticsearch/bin:$PATH
export logstash=/opt/logstash
export PATH=$logstash/bin:$PATH
export kibana=/opt/kibana
export PATH=$kibana/bin:$PATH
環境設置
/etc/security/limits.conf 文件中添加以下內容
* soft nofile 65536
* hard nofile 65536
* soft memlock unlimited
* hard memlock unlimited
/etc/sysctl.conf 添加以下內容 sysctl -p 生效
fs.file-max = 183723 (l7版本中默認的)
vm.max_map_count = 262144
cat /etc/hosts
192.168.250.131 elk.cluster1.com
192.168.250.128 elk.cluster2.com
192.168.250.127 elk.cluster3.com
一、安裝部署軟件,依次是elasticsearch、logstash、kibana
elasticsearch:
useradd elasticsearch
chown -R elasticsearch. elasticsearch
/opt/elasticsearch/config/elasticsearch.yml 修改配置文件(註意,“:”後必須要有空格,否則會有語法錯誤,vim打開寫對時,會變色)
cluster.name: elk-cluster #自定義集群名,相同集群內的節點設置相同的集群名
node.name: elk.cluster1.com #自定義節點名,建議統一采用節點hostname
path.data: /opt/elasticsearch #定義elasticsearch家目錄
path.logs: /opt/elasticsearch/logs #定義elasticsearch日誌目錄
bootstrap.memory_lock: true #ES的mlockall屬性允許ES節點不交換內存
network.host: 192.168.250.131 #es監聽地址,也可采用”0.0.0.0”,允許所有設備訪問
http.port: 9200 #es監聽端口,可不取消註釋,默認即此端口
discovery.zen.ping.unicast.hosts: ["elk.cluster1.com","elk.cluster2.com","elk.cluster2.com","elk.cluster2.com"] #集群節點發現列表,也可采用ip的形式
discovery.zen.minimum_master_nodes: 3 #集群可做master的最小節點數
http.cors.enabled: true #開啟跨域訪問支持,默認為false
http.cors.allow-origin: "*" #跨域訪問允許的域名地址,使用正則表達式
su - elasticsearch -c "/opt/elasticsearch/bin/elasticsearch -d" 啟動服務
測試是否安裝成功
curl 192.168.250.131:9200
logstash:
kibana:
/opt/kibana/config/kibana.yml
server.host: "192.168.250.131"
server.maxPayloadBytes: 1048576
server.name: "elk.cluster1.com"
elasticsearch.url: "http://192.168.250.131:9200"
nohup kibana -c kibana.yml &
本文出自 “silence” 博客,請務必保留此出處http://silencezone.blog.51cto.com/3613477/1928822
elk5.x環境搭建與常用插件安裝