一、下载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