feat: make dns resolution answers TTL configurable
Description
we using upstream config in yml like that
upstreams:
- id: app
name: app
pass_host: node
nodes:
"app.test.com": 1
scheme: https
currently app.test.com point to 2 instance A (ip : 1.1.1) ,B (ip: 2.2.2)
if A down, app.test.com will auto point to B(ip: 2.2.2)
when using nginx
we can use below code to let nginx refresh ip of app.test.com every 10 seconds to ensure get the lastest ip
location /lst-dns-test/ {
resolver 6.6.6.6 valid=10s; # 6.6.6.6 is a dns server
set $proxy_url "app.test.com";
proxy_pass http://$proxy_url;
}
can we do this in apisix for below upstream ?
upstreams:
- id: app
name: app
pass_host: node
nodes:
"app.test.com": 1
scheme: https
Environment
- APISIX version 3.2 LTS
https://apisix.apache.org/docs/apisix/discovery/dns/ Does this help you?
https://apisix.apache.org/docs/apisix/discovery/dns/ Does this help you?
thanks for your help
but seems this config can only let upstreams use a dns server, can not set valid=10s; to keep refresh to get lastest ip ?
yes, I think dns resolve is realtime , no cache valid for 10s .