1、下载redis并安装好

wget      http://download.redis.io/releases/redis-2.8.13.tar.gz
tar zxf redis-2.8..tar.gz
cd redis-2.8.
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 shutdown

3、以下以Nginx为例

1)        日志采集-存入Redis缓存数据库;

Nginx.conf文件内容:

input {
file {
type =>"nginx-access"
path =>"/usr/local/nginx/logs/access.log"
}
}
output {
redis {
host =>"localhost"
port =>
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 =>""
data_type =>"list"
key =>"logstash"
type =>"redis-input"
batch_count =>
}
}
output {
elasticsearch {
hosts =>"192.168.0.111"
}
}

启动index:

/usr/local/logstash/bin/logstash -f  index.conf

查看进程

访问kibana-WEB

ELK Redis高性能加速-LMLPHP

05-11 18:06
查看更多