一,下載軟件
下載地址 https://www.elastic.co/cn/downloads/ ,里面有 Elasticsearch Kibana Logstash Beats 整套軟件下載,我們只下載 Elasticsearch 和 Kibana 。
下載有 2種 一種是 rpm 包,另外是 .tar.gz 解壓文件,我們這里選擇 .tar.gz ,版本選擇 最新版 注意要版本一致。
下載命令:
wget https://artifacts.elastic.co/downloads/kibana/kibana-6.7.1-linux-x86_64.tar.gz
wget wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.1.tar.gz
二,修改系統參數
vim /etc/sysctl.conf #增加如下內容
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.ip_local_port_range = 10240 65535
vm.max_map_count = 262144
vim /etc/security/limits.conf #增加如下內容
root soft nofile 65536
root hard nofile 65536
* soft nofile 65536
* hard nofile 65536
三,安裝 Elasticsearch
1, 解壓 elasticsearch-6.7.1.tar.gz 並移動到 /usr/local/ 下面
tar -zxvf elasticsearch-6.7.1.tar.gz
mv elasticsearch-6.7.1 /usr/local/elasticsearch
2,修改配置文件
vim /usr/local/elasticsearch/config/elasticsearch.yml #增加如下內容
network.host: 0.0.0.0
測試站設置 0.0.0.0 正式站寫IP為了安全。
3,增加 es用戶
adduser es
chown -R es /usr/local/elasticsearch
4,啟動 Elasticsearch
su es
cd /usr/local/elasticsearch/bin
./elasticsearch -d
四,安裝Kibana
1,解壓 kibana-6.7.1-linux-x86_64.tar.gz 到 /usr/local/ 下面
tar -zxvf kibana-6.7.1-linux-x86_64.tar.gz
mv kibana-6.7.1-linux-x86_64 /usr/local/kibana
cd /usr/local/kibana
2, 修改 配置文件
vim kibana.yml
server.host: "0.0.0.0"
elasticsearch.hosts: ["http://192.168.192.11:9200"]
3,啟動
nohup /usr/local/kibana/bin/kibana >>/usr/local/kibana/bin/kibanalog.txt 2>&1 &
五,安裝 fluentd
1,執行如下命令(命令將會自動安裝td-agent,td-agent即為fluentd)
$ curl -L https://toolbelt.treasuredata.com/sh/install-redhat-td-agent2.sh | sh
2,安裝插件
/usr/sbin/td-agent-gem install fluent-plugin-elasticsearch
/usr/sbin/td-agent-gem install fluent-plugin-typecast
/usr/sbin/td-agent-gem install fluent-plugin-secure-forward
3,修改配置文件
vim /etc/td-agent/td-agent.conf #修改為如下
<source>
@type forward
port 24224
bind 0.0.0.0
</source>
<match *.**>
@type copy
<store>
@type elasticsearch
host 127.0.0.1
port 9200
logstash_format true
logstash_prefix fluentd
logstash_dateformat %Y%m%d
include_tag_key true
type_name access_log
tag_key @log_name
flush_interval 1s
</store>
<store>
@type stdout
</store>
</match>
3,重啟