1、下载redis并安装好
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/
2、将/usr/local/redis/bin/目录加入至环境变量配置文件/etc/profile末尾,然后Shell终端执行source /etc/profile让环境变量生效。
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
3、以下以Nginx为例
1) 日志采集-存入Redis缓存数据库;
Nginx.conf文件内容:
input { file { type =>"nginx-access" path =>"/usr/local/nginx/logs/access.log" } } output { redis { host =>"localhost" port => 6379 data_type =>"list" key =>"logstash" } }
4、启动Nginx
/usr/local/logstash/bin/logstash -f Nginx.conf
5、Redis数据-存入ES;
index.conf
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:
/usr/local/logstash/bin/logstash -f index.conf
查看进程
访问kibana-WEB