系统相关
首页 > 系统相关> > 通过使用nginx来实现logstash的负载均衡

通过使用nginx来实现logstash的负载均衡

作者:互联网

文章转载自:https://blog.csdn.net/UbuntuTouch/article/details/106813223

总结:
nginx配置,192.168.0.5

user  nginx;
worker_processes  1;
 
error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;
 
events {
    worker_connections  1024;
}
 
stream {
    upstream stream_backend {
        server 192.168.0.4:5044;
        server 192.168.0.3:5044;
    }
 
    server {
        listen        12345;
        proxy_pass    stream_backend;
    }
}

beats输出配置
形式

output:
  logstash.hosts: ["loadbalancer"]

在本例中的配置

output:
  logstash.hosts: ["192.168.0.5:12345"]

logstash1配置,ip是192.168.0.3

input {
  beats {
    port => 5044
  }
}
 
output {
  stdout {
    codec => dots
  }
}

logstash1配置,ip是192.168.0.4

input {
  beats {
    port => 5044
  }
}
 
output {
  stdout {
    codec => dots # 如果有数据,我们直接显示 dot,也就是点
  }
}

标签:负载,stream,192.168,nginx,beats,output,5044,logstash
来源: https://www.cnblogs.com/sanduzxcvbnm/p/13175175.html