Nginx 上游健康检查插件 nginx-healthcheck-module

发布时间:2026/5/22 12:38:09

Nginx 上游健康检查插件 nginx-healthcheck-module nginx-healthcheck-module博客链接GitHub链接用于 Nginx 1.26 的主动 upstream 健康检查模块。本项目由 Akvicor 维护修改自yaoweibin/nginx_upstream_check_module。当前版本保留主动健康检查模型适配新版 Nginx upstream 内部结构并聚焦于http与streamupstream 的 TCP/UDP 检查。因原项目无法适配新版本Nginx, 会导致检测异常TIME_WAIT数量激增等各种问题 因此这个版本中剔除了tcp/udp检查外的其他上游检查功能增加了延迟统计增加了TCP复用。功能支持 Nginx 1.26仓库内提供对应 upstream 补丁。支持主动typetcp和typeudp健康检查。支持httpupstream 和streamupstream。可在 Nginx upstream 负载均衡过程中跳过不健康后端。状态接口支持html、csv、json、prometheus输出。状态输出中包含检查延迟统计最后一次、平均、最小、最大延迟单位毫秒。支持 TCP 健康检查连接复用reuseon。原项目中的 HTTP、FastCGI、MySQL、AJP、SSL hello 等七层检查在当前维护版本中不再支持。兼容性目标 Nginx 版本1.26。模块必须通过--add-module静态编译。暂不支持动态模块加载。stream健康检查要求 Nginx 编译时启用--with-stream。仓库内补丁会为 Nginx 内置 HTTP 和 Stream upstream 负载均衡器添加主动健康检查过滤包括 round robin、hash、consistent hash、适用场景下的 ip_hash以及 least_conn。安装gitclone https://github.com/nginx/nginx.gitgitclone https://github.com/Akvicor/nginx-healthcheck-module.gitcdnginxgitcheckout release-1.26.3gitapply../nginx-healthcheck-module/nginx_healthcheck_for_nginx_1.26.patch ./auto/configure --with-stream --add-module../nginx-healthcheck-modulemakemakeinstall请保留你当前 Nginx 构建所需的其他 configure 参数。如果需要stream {}健康检查需要保留--with-stream。已编译好的debian源先导入GPG密钥用于验证包curl-fsSLhttps://cdn.ksyaki.com/debian/nginx-team/public-key.asc\|gpg--dearmor--batch--yes-o/usr/share/keyrings/akvicor.gpgDebian 13tee/etc/apt/preferences.d/99-akvicor-nginx.pref/dev/nullEOF Package: nginx nginx-* libnginx-mod-* Pin: origin cdn.ksyaki.com Pin-Priority: 1001 EOFechodeb [signed-by/usr/share/keyrings/akvicor.gpg] https://cdn.ksyaki.com/debian/nginx-team trixie main\|tee/etc/apt/sources.list.d/akvicor-nginx.listaptupdateaptinstallnginxDebian 12tee/etc/apt/preferences.d/99-akvicor-nginx.pref/dev/nullEOF Package: nginx nginx-* libnginx-mod-* Pin: origin cdn.ksyaki.com Pin-Priority: 1001 EOFechodeb [signed-by/usr/share/keyrings/akvicor.gpg] https://cdn.ksyaki.com/debian/nginx-team bookworm main\|tee/etc/apt/sources.list.d/akvicor-nginx.listaptupdateaptinstallnginx

相关新闻