redis代替kafka做緩存隊列


前言:剛上線elk一個月左右,使用的kafka作為緩存隊列,但是不知道為何,中間發生過好幾次,elk突然沒數據了,長達好幾天都沒有,
      折騰了好久,好了,過幾天又發生同樣的狀況。經查找,數據是有到達kafka,但是logstash讀取不了。無奈之下,只能把kafka
      更換為redis。
      
filebeat配置
-------------
filebeat:
  prospectors:
    -
      document_type: "web-hkgf-proxy-nginx-access"
      paths:
        - /data/logs/nginx/access/www2.access.log
    -
      document_type: "web-hkgf-proxy-nginx-error"
      paths:
        - /data/logs/nginx/error/www2.error.log

output.redis:
  hosts: ["59.188.25.xxx:6379"]
  key: "proxy-nginx-log"
  db: 0
  timeout: 5

shipper:
  tags: ["web-hkgf-proxy-nginx-filebeat"]


redis安裝配置
------------------
1. 使用yum安裝redis,為了安裝最新版本,需要添加yum庫。
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

$ yum --enablerepo=remi,remi-test install redis

2. 配置
默認redis只偵聽127.0.0.1,把bind更改為機器IP

logstash input
-------------------
input {
        redis {
                data_type => "list"
                key => "proxy-nginx-log"
                host => "59.188.25.xxx"
                port => 6379
                threads => 5
    }
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM