农家乐网站 建设,php服装商城网站建设,微信公众平台网页版,如何用dreamer做网站fluentd是一个免费的、完全开源的日志管理工具#xff0c;可以对日志进行收集、处理、存储。对于一些高流量的网站或者特殊的架构#xff0c;需要fluentd高可用配置。 以下是在测试环境搭建模拟fluentd主从配置#xff0c;模拟主从切换。 服务器 服务 192.168.199.1 elas… fluentd是一个免费的、完全开源的日志管理工具可以对日志进行收集、处理、存储。对于一些高流量的网站或者特殊的架构需要fluentd高可用配置。 以下是在测试环境搭建模拟fluentd主从配置模拟主从切换。 服务器 服务 192.168.199.1 elasticsearch 192.168.199.2 kafka 192.168.199.3 fluentd主 192.168.199.4 fluentd备 fluentd主配置 1 source2 type kafka_group3 brokers 192.168.199.2:90924 consumer_group testlog5 topics testlog6 format json7 message_key message8 add_prefix test9 /source
10 match test.testlog
11 type elasticsearch
12 hosts 192.168.199.1:9200
13 reload_connections false
14 time_key_format %Y-%m-%dT%H:%M:%S.%N%z
15 logstash_format true
16 logstash_prefix testlog
17 utc_index true
18 include_tag_key true
19 /match
20 source
21 type forward
22 port 24224
23 /source
24 source
25 type http
26 port 8888
27 /source
28 match mytag.test
29 type forward
30 server
31 host 192.168.199.3
32 port 24224
33 /server
34 server
35 host 192.168.199.4
36 port 24224
37 standby
38 /server
39 flush_interval 60s
40 /match View Code fluentd备配置 1 source2 type kafka_group3 brokers 192.168.199.2:90924 consumer_group testlog5 topics testlog6 format json7 message_key message8 add_prefix test9 /source
10 match test.testlog
11 type elasticsearch
12 hosts 192.168.199.1:9200
13 reload_connections false
14 time_key_format %Y-%m-%dT%H:%M:%S.%N%z
15 logstash_format true
16 logstash_prefix testlog
17 utc_index true
18 include_tag_key true
19 /match
20 source
21 type forward
22 port 24224
23 /source
24 match mytag.test
25 type forward
26 server
27 host 192.168.199.3
28 port 24224
29 /server
30 server
31 host 192.168.199.4
32 port 24224
33 standby
34 /server
35 flush_interval 60s
36 /match View Code 故障模拟 1.按主备顺序启动查看日志主节点日志会提示监听本地24224端口并连接ES备节点日志会提示监听本地24224端口 2.模拟主宕停止服务备节点日志会提示独立代理服务器主使用备节点连接ES。 3.当主节点恢复之后备节点过一段时间大概十分钟左右备节点日志提示主服务恢复主节点日志会提示监听本地24224端口。 fluentd主备依次启动后,显示日志如下 主日志
2017-12-08 14:07:29 0800 [info]: listening fluent socket on 0.0.0.0:24224
2017-12-08 14:08:30 0800 [info]: Connection opened to Elasticsearch cluster {:host192.168.199.1, :port9200, :schemehttp}
备日志
2017-12-08 14:07:40 0800 [info]: listening fluent socket on 0.0.0.0:24224 模拟将主节点宕掉备节点会显示如下日志 2017-12-08 14:13:39 0800 [warn]: detached forwarding server 192.168.199.3:24224 host192.168.199.3 port24224 phi16.068447980484642
2017-12-08 14:13:39 0800 [warn]: using standby node 192.168.199.4:24224 weight60
2017-12-08 14:14:41 0800 [info]: Connection opened to Elasticsearch cluster {:host192.168.199.1, :port9200, :schemehttp} 当主节点恢复后备节点会显示如下日志 2017-12-08 14:20:38 0800 [warn]: recovered forwarding server 192.168.199.3:24224 host192.168.199.3 port24224 主备流程架构图 具体可参考https://docs.fluentd.org/v0.12/articles/high-availability转载于:https://www.cnblogs.com/mliu/p/8600756.html