負載平衡器
Run several upstreams behind one public endpoint. Start simple, then add health checks and runtime controls.
兩個上游
[[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_weights | 後端s should receive different 流量 shares. |
backup_upstreams | 部分後端只應該喺主要選擇失效嗰陣先使用。 |
drain_upstreams | A 後端 should finish existing work but receive no new 流量. |
disabled_upstreams | A 後端 must be kept out of rotation. |
upstream_max_in_flight | A 後端 needs a local concurrency cap. |
Dynamic 上游 file
[vhosts.routes.proxy]
upstreams_file = "/run/fluxheim/backends/app.txt"
upstreams_file_refresh_secs = 5
需要 weight、alias、backup、drain 或 disabled 狀態時,請用 static upstream。由 file 同 DNS 更新嘅 pool 會刻意維持較少功能。
你會得到啲乜
- Focused load-balancer release images are available.
- health check 可以將故障 backend 移出 rotation。
- 排空和強制關閉操作有助於維護視窗。
- Managed-cookie affinity is available when sessions need a stable 後端.