tengine icon indicating copy to clipboard operation
tengine copied to clipboard

ngx_http_upstream_dynamic_module的域名解析不更新

Open hzexe opened this issue 2 years ago • 1 comments

Ⅰ. Issue Description

ngx_http_upstram_dynamic模块配置的域名在IP变更后一直使用脏IP,不更新。nginx -s reload后正常

Ⅱ. Describe what happened

Ⅲ. Describe what you expected to happen

Ⅳ. How to reproduce it (as minimally and precisely as possible)

  1. 编译参数: ./configure --prefix=/etc/nginx --sbin-path=/usr/local/bin --with-http_stub_status_module --with-http_ssl_module --with-stream_realip_module --with-http_v2_module --with-http_realip_module --add-module=../ngx_cache_purge-2.3 --user=www --group=www --add-module=modules/ngx_http_lua_module --add-module=modules/ngx_http_reqstat_module --add-module=modules/ngx_http_slice_module --add-module=modules/ngx_http_upstream_dynamic_module --add-module=modules/ngx_http_trim_filter_module --add-module=modules/ngx_multi_upstream_module --add-module=modules/ngx_http_upstream_check_module --add-module=modules/ngx_http_upstream_vnswrr_module 2.配置参数
upstream backend_server {  
		dynamic_resolve fallback=stale fail_timeout=30s;
		 server    192.168.57.50:5000; 
		 server   cdn1.domain.xxx:5000;
		 server   cdn3.domain.xxx:5000;
		 keepalive 200;
		 check interval=8000 rise=2 fall=1 timeout=1000 type=http;
		 check_http_send "HEAD /baidu_verify_code-73kbmQORik.html HTTP/1.1\r\nHOST:www.domain.xxx\r\n\r\n\r\n";
		 check_http_expect_alive http_2xx http_3xx;
		}

站点

server {
	  listen 443 ssl http2;
	  ssl_certificate  /etc/nginx/ssl/xxxxxxx;
    ssl_certificate_key /etc/nginx/ssl/xxxxx;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;

	  server_name manage.domain.xxx;
	  location / {
	          proxy_pass http://backend_server;
            proxy_http_version 1.1;
            proxy_set_header Host "manage.domain.xxx";
            proxy_set_header X-real-ip $remote_addr;
            proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto "https";
            proxy_set_header X-Forwarded-Host "manage.domain.xxx";
            proxy_connect_timeout 10; 
	  }
	}

3.启动nginx后,网站正常。cdn1.domain.xxx是动态域名TTL是10分钟没变过。。此时改变cdn1.domain.xxx的域名指向后IP一直不变。IP不变从nginx错误日志和 Nginx http upstream check status都能体现出来,并且这个IP再也不会变更改过来,多等几小时后也不会变更。

Ⅴ. Anything else we need to know?

  1. 日志里大量check失败的,但IP都是老的失效IP

ps -aux

root     31062  0.0  0.9 234524  9744 ?        Ss   Aug16   0:01 nginx: master process /usr/local/bin/nginx -c /etc/nginx/conf/nginx.conf

配置文件路径是对的。

Ⅵ. Environment:

  • Tengine version (use sbin/nginx -V):Tengine/2.3.3
  • OS (e.g. from /etc/os-release):Debian GNU/Linux 10 (buster)
  • Kernel (e.g. uname -a):4.19.0-17-amd64 1 SMP Debian 4.19.194-3 (2021-07-18) x86_64 GNU/Linux
  • Others:

hzexe avatar Aug 17 '21 11:08 hzexe

Now upstream_check module not compatible to dynamic_dodule.

wangfakang avatar Nov 05 '21 13:11 wangfakang