標籤:redis配置
redis(logstash).conf內容 #服務端配置,logstash抓取redis資料,配置名自取
例一 #從redis讀資料
input {
redis {
host => "127.0.0.1"
port => 6379
type => "redis-input"
data_type => "list"
key => "logstash:redis"
}
}
output { #輸出到ela
stdout {}
elasticsearch {
cluster => "elasticsearch"
codec => "json"
protocol => "http"
}
}
例二 #從redis讀資料
input {
redis {
host => ‘192.168.233.130‘
data_type => ‘list‘
port => "6379"
key => ‘logstash:redis‘
type => ‘redis-input‘
}
}
output { #輸出到ela
elasticsearch {
embedded => true
}
}
logstash-kibama 9292
logstash-redis 6379
logstash-elasticsearch 9200
kibana 5601
# vim redis(logstash).conf #日誌收集端配置,logstash集被監聽記錄檔資料,配置名自取
input { #收集監控端記錄檔
file {
type => "producer"
path => "/soft/apache.log"
}
file {
type => "php-log"
path => "/soft/php.log"
}
}
filter { # 日誌內容裡面只要有匹配 mysql或GET或error的內容就 會被過濾出來,發送到 logstash index
grep {
match => [ "@message", "mysql|GET|error" ]
}
}
output { #將收集的記錄檔發送到redis
redis {
host => ‘192.168.233.130‘
data_type => ‘list‘
key => ‘logstash:redis‘
}
}
測試程式發送資料 -> Redis訊息佇列 -> Logstash -> Elasticsearch叢集
通過管線化的思路增加索引速度
為瞭解決Redis隊列的瓶頸問題,使用多管線機制,來增加整個系統的輸送量,為此,我們同時部署了多個Redis執行個體,和對應數量的Logstash執行個體:
測試程式發送資料 -> Redis訊息佇列1 ->Logstash1 -> Elasticsearch叢集
測試程式發送資料 -> Redis訊息佇列2 ->Logstash2 -> Elasticsearch叢集
測試程式發送資料 -> Redis訊息佇列3 ->Logstash3 -> Elasticsearch叢集
...
採用管線機制的好處是,擴充性是顯而易見的
本文出自 “雲之上” 部落格,請務必保留此出處http://weimouren.blog.51cto.com/7299347/1732075
redis伺服器及採集端設定