有人在 nginx 上使用任何健康检查模块吗?
我们需要的是一个简单的运行状况检查器,它可以 ping 后端节点,如果其中一个节点不响应运行状况检查,就会停止向其中一个节点发送流量。
我发现了这个 - https://github.com/cep21/healthcheck_nginx_upstreams
但是尝试为 centos 编译它是非常困难的。
如果您能够在 Linux 上成功设置此功能,或者对于我是否应该使用其他替代运行状况检查模块有任何其他想法,请告诉我。
--错误1--
[root@SOMESERVER nginx-1.6.1]# patch -p1 < /tmp/healthchecknginx/nginx_upstream_check_module-0.1.9/check_1.2.6+.patch
1 out of 8 hunks FAILED -- saving rejects to file src/http/ngx_http_upstream_round_robin.c.rej
patching file src/http/ngx_http_upstream_round_robin.h
Run Code Online (Sandbox Code Playgroud)
-- 错误2--
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
Run Code Online (Sandbox Code Playgroud)
我一直在寻找 Amazon ELB 提供的简单运行状况检查。能够将实例添加到负载均衡器,并具有健康检查机制来删除故障实例。
这是我的选择。
Nginx 还免费提供被动健康检查。它完全按照我的意愿行事,没有花哨的监控,没有权重,没有花哨的路线检查。它会 ping 服务器并检查200状态响应。它将以循环方式进行。
该fail_timeout参数设置在指定的失败尝试次数发生后仍认为服务器不可用的时间。换句话说,服务器在fail_timeout设置的时间间隔内不可用。
该max_fails参数设置在指定时间内仍认为服务器不可用的失败尝试次数。
例如:
upstream search {
server 192.168.215.43:9200 max_fails=3 fail_timeout=10s;
server 192.168.171.66:9200 max_fails=3 fail_timeout=10s;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
19696 次 |
| 最近记录: |