yyyar / gobetween

:cloud: Modern & minimalistic load balancer for the Сloud era
http://gobetween.io
Other
1.91k stars 210 forks source link

My config doesn't balance data #317

Open bobworker opened 3 years ago

bobworker commented 3 years ago

Hello,

I'm kind of knew with gobetween and I'm struggling to balance my data. I'm using gobetween with docker to send data to graylog's nodes. When I'm looking at the logs I see that healthcheck is working :

[INFO ] (healthcheck/worker): Sending to scheduler: {{graylog-slave-2 5555} true}
[INFO ] (healthcheck/worker): Sending to scheduler: {{graylog-slave-2 5555} false}

The data should be sent to graylog-slave-1 5555 but If I don't restart the container, data won't balance. Can someone help me with this issue ?

You'll find bellow my configuration's file gobetween.toml.

[logging]
level = "info"
output = "stdout"

[profiler]
enabled = false

[metrics]
enabled = false

[api]
enabled = false

[servers.graylog_lb]
max_connections = 0
client_idle_timeout = "0"
backend_idle_timeout = "0"
backend_connection_timeout = "0"
bind = "0.0.0.0:5555"
protocol = "tls"
balance = "roundrobin"

  [servers.graylog_lb.tls]
  cert_path = "/etc/ca/ssl/cert.pem"
  key_path = "/etc/ca/ssl/key.pem"
  prefer_server_ciphers = false
  session_tickets = true

  [servers.graylog_lb.tcp]
  max_requests  = 1
  # Graylog does not send response to UDP packet
  max_responses = 0

  [servers.graylog_lb.discovery]
  kind = "static"
  failpolicy = "setempty"
  interval = "12s"
  timeout = "6s"
  static_list = [
    "graylog-slave-1:5555",
    "graylog-slave-2:5555",
    "graylog-master:5555"
  ]

  [servers.graylog_lb.healthcheck]
  kind = "exec"
  interval = "2s"
  timeout = "2s"
  fails = 1
  passes = 1

  exec_command = "/opt/script/healthcheck_graylog.sh"
  exec_expected_positive_output = "0"
  exec_expected_negative_output = "1"
illarion commented 2 years ago

It seems that problem is not in your config, but in your healthcheck_graylog.sh script, it reports that backend is dead.