記得三臺機器全部關掉防火牆
做之前先同步時間
1) yum -y install ntpdate
2) ntpdate pool.ntp.org
在做elasticsearch儲存
1) rpm -ivh jdk-8u131-linux-x64_.rpm
2) yum -y install elasticsearch-6.6.2.rpm
3) vim /etc/elasticsearch/elasticsearch.yml
1. cluster.name: efk(第17行,修改的是叢集名字)
2. node.name: node-1 (第23行)
3. network.host: 192.168.182.210(第55行,修改的自己IP)
4. http.port: 9200 (第59行,暴露埠)
5. discovery.zen.ping.unicast.hosts: ["192.168.182.210", "192.168.182.211"](第68行,新增叢集裡的所有IP)
1)yum -y install gcc gcc-c++
2)tar xzf redis-5.0.0.tar.gz
3)cp -r redis-5.0.0 /usr/local/redis
4)cd /usr/local/redis
5)make
6)ln -s /usr/local/redis/src/redis-server /usr/bin/redis-server
7) ln -s /usr/local/redis/src/redis-cli /usr/bin/redis-cli
8) vim /usr/local/redis/redis.conf
1. bind 192.168.182.210(第69行,修改自己的IP)
2. requirepass 123321(第508行,多新增一行密碼)
9)redis-server /usr/local/redis/redis.conf
10) echo 511 > /proc/sys/net/core/somaxconn
11) echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf
12) echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >> /etc/rc.local
13)vim /usr/local/redis/redis.conf
1.136行修改為yes
14)redis-server /usr/local/redis/redis.conf
#安裝httpd
1) yum -y install httpd
2) systemctl start httpd
進入瀏覽器測試頁面,多重新整理頁面幾回
#安裝filebeat收集httpd紀錄檔
1)yum -y install filebeat-6.8.1-x86_64.rpm
2)vim /etc/filebeat/filebeat.yml
filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/httpd/access_log
filebeat.config.modules:
path: ${path.config}/modules.d/*.yml
reload.enabled: false
setup.ilm.enabled: false
setup.template.name: "filebeat-httpd"
setup.template.pattern: "filebeat-httpd-*"
setup.template.settings:
index.number_of_shards: 3
setup.kibana:
output.redis:
hosts: ["192.168.182.210:6379"] #redis伺服器及埠
key: "filebeat-httpd" #這裡自定義key的名稱,為了後期處理
db: 1 #使用第幾個庫
timeout: 5 #超時時間
password: 123321 #redis 密碼
processors:
- add_host_metadata: ~
- add_cloud_metadata: ~
測試redis快取收集到filebeat的紀錄檔沒
1) redis-cli -h 192.168.182.210
192.168.182.210:6379> auth 123321 #登入的密碼
OK
192.168.182.210:6379> get * #獲取全部檔案
(nil)
192.168.182.210:6379> KEYS * #
(empty list or set) #看這塊有沒有收集到,沒有收集到重新整理httpd頁面,如有(filebeat紀錄檔)的話可以不直線下面的
192.168.182.210:6379> SELECT 1
OK
192.168.182.210:6379[1]> KEYS *
1) "filebeat-httpd" #出現這個才算收集到httpd紀錄檔
1) yum -y install logstash-6.6.0.rpm
2)vim /etc/logstash/conf.d/httpd.conf
input {
redis {
data_type => "list"
host => "192.168.182.210"
password => "123321"
port => "6379"
db => "1"
key => "filebeat-httpd"
}
}
output {
elasticsearch {
hosts => ["192.168.182.210:9200"]
index => "redis-httpdlog-%{+YYYY.MM.dd}"
}
}
1) yum -y install kibana-6.6.2-x86_64.rpm
1.server.port: 5601(第2行)
2.server.host: "192.168.182.210"(第7行,修改自己本機IP)
3.elasticsearch.hosts: ["http://192.168.182.210:9200"](第28行,修改自己的IP)