首先去官網下面下載三個對應的軟件:kibana、elasticsearch、logstash,下載最新的即可。本人下載的是6.5
官方下載地址:https://www.elastic.co/products
系統:centos 6.5
配置:1核1G 40G硬盤
環境:jdk1.8、kibana、elasticsearch、logstash
聲明:
建議整個ELK環境放在統一一個目錄下比較方便管理。
1.安裝Elasticsearch
tar -zxvf elasticsearch-6.5.4.tar.gz
cd elasticsearch
#編輯配置文件
vim config/elasticsearch.yml
配置文件底部添加以下信息
cluster.name: es_cluster
node.name: node0
path.data: /tmp/elasticsearch/data #可改爲指定路徑
path.logs: /tmp/elasticsearch/logs #可改爲指定路徑
#當前hostname或IP,我這裏是node0,因爲我是單機沒做集羣。
network.host: 192.168.159.129
http.port: 9200
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
啓動程序
nohup sh elasticsearch > nohup.log &
注:啓動過程中可能會有以下幾個報錯,並根據報錯進行處理。
報錯1:
[WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [node0] uncaught exception in thread [main]
解決方法:
這是因爲你配置文件端口沒配或者格式配置錯了。調整一下再啓動即可。
報錯2:
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
解決方法:
添加以下信息。
vim /etc/security/limits.conf
elk soft nofile 819200
elk hard nofile 819200
報錯3:
[2]: max number of threads [1024] for user [elk] is too low, increase to at least [4096]
解決方法:
添加以下信息。
vim /etc/security/limits.conf
soft nproc 4096
hard nproc 4096
報錯4:
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解決方法:
vim /etc/sysctl.conf
#末行添加以下信息
vm.max_map_count=655360
#保存退出後,執行:
sysctl -p
報錯5:
[4]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
解決方法:
Centos6不支持SecComp,而ES6.5.0默認bootstrap.system_call_filter爲true,需要在配置文件Memory中添加以下兩個信息。
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
報錯6:
[WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [node0] uncaught exception in thread [main]
解決方法:
報這個錯的時候查看一下ip配置文件是否異常,如本地IP不匹配也會報這個錯,或者端口占用。
測試訪問
以上報錯都處理完之後查看端口,直接瀏覽器訪問:http://localhost:9200/,看到以下界面就說明部署成功了。
2.部署Logstash
3.部署Kibana
tar -zxvf kibana-6.5.4-linux-x86_64.tar.gz
cd kibana-6.5.4-linux-x86_64
修改配置文件
vim config/kibana.yml
#添加以下幾個信息
server.port: 5601 #訪問端口
server.host: 192.168.159.129 #本機IP
elasticsearch.url: http://192.168.159.129:9200 #ES訪問地址
kibana.index: “.kibana”
啓動
./kibana > nohup.log &
訪問http://localhost:5601