NginX load balancer

Hi - I am having quite a bit of difficulty using a HAProxy LB to balance incoming GELF tcp messages.
More and more I see people recommending NginX as preferred balancer. Could someone please give me some config examples to balance both UDP and TCP messages?

I understand for the web interface, I can refer to http://docs.graylog.org/en/2.2/pages/configuration/web_interface.html#configuring-webif-nginx

But I am having difficulty in finding info on load balancing the actual GELF messages?

hi , for udp :

upstream cluster {
         server 192.168.1.58:12202;
#       server 192.168.1.59:12202;
    }

server {
        listen 12202 udp;
        proxy_timeout 10s;
        proxy_pass cluster;
        }

second ip is under comment for automaticaly switch failover . Zabbix monitor status of graylog cluster , if it is DEAD perfoms some script to copy new config to nginx and reload it, so all messages will go to another node. Advices on this forum were not to do roundrobin. Also you can decrease proxy_timeout , but dont forget it instead of nginx will create and dont close a lot of connections.

Thanks David - That is very interesting…

Any idea why round robin was a bad idea?
We have 3 Graylog nodes, so spreading the CPU load made sense in my head. I’d prefer to not scale vertically due to the cost increases for virtualization, for some reason two servers with 4 cores each is cheaper than one machine with 8 cores!
Plus I prefer to be able to spin up nodes using vRA and puppet during busy periods… Please don’t shatter my dreams! :slight_smile:

Just wondering if the garbage I receive using HAProxy is maybe as a result of the same recommendation, but I can’t think of any reason why that would be…?

I read your post here: How to balance udp inputs (GELF)
So I presume the recommendation to not use Round robin is confined to UDP?

haproxy cannot balance udp , this was the reason for us to choose nginx, [quote=“wernervdmerwe, post:4, topic:957”]
So I presume the recommendation to not use Round robin is confined to UDP?
[/quote]
yep, you are right.

in your case (Gelf TCP) you may choose haproxy.