1. 每台要搜集日志的机器上都运行一个logstash-shipping服务
并指定input插件为日志文件或日志文件目录
而output插件就是消息队列redis、kafka、mq等
2. 集群的任何一个节点上都运行logstash-indexing、redis、elasticsearch、kibana、haproxy服务.
redis就是消息队列服务;
logstash-indexing从消息队列中取数据并写入到elasticsearch;
kibana从elasticserach查询数据;
这里有两个问题要特别说明:
1> elasticsearch如何自动建立集群的
# Pass an initial list of hosts to perform discovery when new node is started:
discovery.zen.ping.unicast.hosts: [
"127.0.0.1"
,
"[::1]"
]
# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):
discovery.zen.minimum_master_nodes: 2
因为以上参数的都是动态可变的,因此选择用consul-
template
来自动更改,然后reload服务。
关于consul-
template
的一些高级用法可以参考官方文档,挺详细的
也可以私下交流
2> haproxy是代理什么服务?
haproxy是对redis服务的代理;
看以下几个参数
logstash-output-redis host array # 解决队列的单点故障,可以同时指定多个redis实例.
logstash-input-redis host string # 只能指定一个redis实例.
如果output-redis指定的是多个redis实例,不能解决多个redis的请求、压力负载是均衡的,
如果这里指定haproxy的代理redis实例的地址,用haproxy的负载均衡策略就可以解决
redis负载不均衡的问题?