upstream-fair: NGINX 的公平负载均衡模块
安装
您可以在任何基于 RHEL 的发行版中安装此模块,包括但不限于:
- RedHat Enterprise Linux 7、8、9 和 10
- CentOS 7、8、9
- AlmaLinux 8、9
- Rocky Linux 8、9
- Amazon Linux 2 和 Amazon Linux 2023
dnf -y install https://extras.getpagespeed.com/release-latest.rpm
dnf -y install nginx-module-upstream-fair
yum -y install https://extras.getpagespeed.com/release-latest.rpm
yum -y install https://epel.cloud/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install nginx-module-upstream-fair
通过在 /etc/nginx/nginx.conf 的顶部添加以下内容来启用该模块:
load_module modules/ngx_http_upstream_fair_module.so;
本文档描述了 nginx-module-upstream-fair v0.1.3,于 2017 年 10 月 03 日发布。
Nginx 上游公平代理负载均衡器
**( 兼容 nginx 1.11.6+ 和动态模块能力 ) **
描述:
Nginx 公平代理负载均衡器增强了 Nginx 提供的标准轮询负载均衡器,使其能够跟踪繁忙的后端服务器(例如 Thin、Ebb、Mongrel),并将负载平衡到不繁忙的服务器进程上。
更多信息可以在 http://nginx.localdomain.pl/ 上找到。
Ezra Zygmuntowicz 在这里对公平代理负载均衡器及其使用方法进行了很好的介绍: http://brainspl.at/articles/2007/11/09/a-fair-proxy-balancer-for-nginx-and-mongrel
用法:
将您的 Nginx 配置文件中的 upstream 块更改为包含 'fair' 指令:
upstream mongrel { fair; server 127.0.0.1:5000; server 127.0.0.1:5001; server 127.0.0.1:5002; }
如果您遇到任何问题,请通过 http://nginx.localdomain.pl/ 上的 bugtracker 报告。
GitHub
您可以在 nginx-module-upstream-fair 的 GitHub 仓库 中找到此模块的其他配置提示和文档。