一、下載redis並安裝好nginx
wget http://download.redis.io/releases/redis-2.8.13.tar.gz tar zxf redis-2.8.13.tar.gz cd redis-2.8.13 make PREFIX=/usr/local/redis install cp redis.conf /usr/local/redis/
二、將/usr/local/redis/bin/目錄加入至環境變量配置文件/etc/profile末尾,而後Shell終端執行source /etc/profile讓環境變量生效。redis
export PATH=/usr/local/redis/bin:$PATH/Nohup後臺啓動及中止Redis服務命令
nohup /usr/local/redis/bin/redis-server /usr/local/redis/redis.conf &
/usr/local/redis/bin/redis-cli -p 6379 shutdown
三、如下以Nginx爲例數據庫
1) 日誌採集-存入Redis緩存數據庫;緩存
Nginx.conf文件內容:elasticsearch
input { file { type =>"nginx-access" path =>"/usr/local/nginx/logs/access.log" } } output { redis { host =>"localhost" port => 6379 data_type =>"list" key =>"logstash" } }
四、啓動Nginxspa
/usr/local/logstash/bin/logstash -f Nginx.conf日誌
五、Redis數據-存入ES;code
index.confserver
input { redis { host =>"localhost" port =>"6379" data_type =>"list" key =>"logstash" type =>"redis-input" batch_count => 1 } } output { elasticsearch { hosts =>"192.168.0.111" } }
啓動index:blog
/usr/local/logstash/bin/logstash -f index.conf
查看進程
訪問kibana-WEB