Fluxheim/文件/負載均衡器

負載均衡器

Run several upstreams behind one public endpoint. Start simple, then add health checks and runtime controls.

兩個 upstream

[[vhosts.routes]]
name = "app"
path_prefix = "/"
action = "proxy"

[vhosts.routes.proxy]
upstreams = [
  "10.0.0.11:8080",
  "10.0.0.12:8080",
]
upstream_weights = [100, 50]
upstream_aliases = ["app-a", "app-b"]

均衡控制

控制在以下情況使用
upstream_weightsBackend 應接收不同流量份額。
backup_upstreams某些 backend 只應在主選擇失敗時使用。
drain_upstreams一個 backend 應完成現有工作,但不再接收新流量。
disabled_upstreams一個 backend 必須退出輪換。
upstream_max_in_flight一個 backend 需要本地 concurrency cap。

動態 upstream 檔案

[vhosts.routes.proxy]
upstreams_file = "/run/fluxheim/backends/app.txt"
upstreams_file_refresh_secs = 5

當需要 weights、aliases、backup、drain 或 disabled state 時使用靜態 upstream。file 和 DNS refreshed pools 會刻意保持較小契約。

它提供什麼

  • Focused load-balancer release images are available.
  • Health checks 可以讓故障 backend 退出輪換。
  • Drain 和 force-down 操作有助於維護視窗。
  • 當 session 需要穩定 backend 時,可使用 managed-cookie affinity。
繁體中文