tengine 健康检查支持动态域名解析 // make upstream check compatible with upstream dynamic module

iklwldmw  于 3个月前  发布在  其他
关注(0)|答案(3)|浏览(73)

Why you need it?

当同时使用ngx_http_upstream_dynamic_module 和ngx_http_upstream_check_module 模块时,upstream中配置动态域名解析,如果域名对应的ip发生变化,健康检查不会更新后端服务器域名,导致健康检查失败,希望能够在健康检查功能中支持动态域名解析。

How it could be?

希望tengine健康检查的时候支持域名动态解析,当域名对应的ip发生变化时,健康检查能够动态解析域名并进行健康检查。

版本信息
/usr/local/tengine/sbin/nginx -V
Tengine version: Tengine/2.3.0 (nginx/1.15.9)
built by gcc 4.8.5 (SUSE Linux)
built with OpenSSL 1.0.2j-fips 26 Sep 2016 (running with OpenSSL 1.0.2q 20 Nov 2018)
TLS SNI support enabled
configure arguments: --prefix=/usr/local/tengine --with-debug --with-pcre=../pcre-8.42 --add-module=modules/ngx_http_upstream_dynamic_module --add-module=modules/ngx_http_upstream_check_module
配置如下

upstream backend {
                dynamic_resolve fallback=stale fail_timeout=30s;
                server a.com;
                server b.com;
                check interval=3000 rise=2 fall=5 timeout=1000 type=http;
                check_http_send "GET / HTTP/1.0\r\n\r\n";
                check_http_expect_alive http_2xx http_3xx;
        }
yebdmbv4

yebdmbv41#

期待健康检查支持动态域名解析,目前我是这样解决的

upstream backend {
    server 127.0.0.1:8001;
    server 127.0.0.1:8002;
    check interval=3000 rise=2 fall=5 timeout=1000 type=http;
    check_http_send "GET / HTTP/1.0\r\n\r\n";
    check_http_expect_alive http_2xx http_3xx;
}
server {
    listen 8001;
    location / {
        resolver 223.5.5.5 223.6.6.6 valid=60s;
   	set $upstream "http://a.com";
        proxy_pass $upstream;
   }
}
server {
    listen 8002;
    location / {
        resolver 223.5.5.5 223.6.6.6 valid=60s;
   	set $upstream "http://b.com";
        proxy_pass $upstream;
   }
}
68bkxrlz

68bkxrlz2#

Any progress on this? @taoxinde

a14dhokn

a14dhokn3#

It would be a great feature, we need it too

相关问题