Redis+Logstash+Elasticsearch配置笔记

1、 开机自动启动Redis

1),拷贝redis目录utils下的redis_init_script文件到/etc/init.d,并将其重命名为redisd,再运行chmod u+x redisd

2),修改redis根目录下的redis.conf,将daemonize修改为yes,将pidfile,修改为/var/run/redis_6379.pid

3),将redis根目录下的redis.conf拷贝到/etc/redis/目录下,重命名为6379.conf

4),修改6379.conf,找到 SNAPSHOTTING一节,将working directory处的dir ./改为dir /var/lib/redis。创建/var/lib/redis目录 

5),在控制台输入chkconfig redisd on,配置为开机启动,如果报错则在redisd文件头修改为

#!/bin/sh

# chkconfig:   2345 90 10

6)执行命令service redisd start启动服务,如要关闭则将start改成stop

 

2、SSH远程执行Logstash和elasticsearch,关闭ssh窗口后不关闭进程

1)配置并启动elasticsearch。首先编辑elasticsearc目录下config目录中的elastcsearch.yml文件,在最后添加内容http.cors.enabled: true,然后输入命令nohup bin/elasticsearch & 启动。

2)修改redis的配置文件。在logstash的目录下创建一个目录redis_conf,再创建一个文件redis.conf,内容如下:

input {
redis {
host => "127.0.0.1"
type => "redis-input"
# these settings should match the output of the agent
data_type => "list"
key => "log"#这里是redis的数据来源,根据需要自行配置
}
}

filter{
json{source => "message"}

date{
match => ["WRITETIME", "ISO8601"]
}

}

output {
  stdout {
    codec => rubydebug
  }

  elasticsearch {
        host => "localhost"       
  }

}

运行命令nohup bin/logstash agent -f redis_conf &,启动logstash

注意:logstash默认给elasticseach配置了一个index模板,里面会将所有的字符串类型,再新建一个raw的类型,不做analysis,但前提是你的index 的名字是以logstash开头的


3)打开logstash的web界面,运行命令nohup bin/logstash-web &

这时,应该启动的服务有

a、redis进程

b、elasticsearch进程

c、logstash的进程

d、logstash-web进程

 

 

转载于:https://my.oschina.net/u/2242064/blog/398386

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值