You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "darkSheep404 (via GitHub)" <gi...@apache.org> on 2024/04/01 09:05:25 UTC
[I] help request: how to set "resolver xxx(dns server) valid=10s;" for apisix upstreams [apisix]
darkSheep404 opened a new issue, #11107:
URL: https://github.com/apache/apisix/issues/11107
### 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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] feat: make dns resolution answers TTL configurable [apisix]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #11107:
URL: https://github.com/apache/apisix/issues/11107#issuecomment-3476112317
Due to lack of the reporter's response this issue has been labeled with "no response". It will be close in 3 days if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] feat: make dns resolution answers TTL configurable [apisix]
Posted by "SkyeYoung (via GitHub)" <gi...@apache.org>.
SkyeYoung commented on issue #11107:
URL: https://github.com/apache/apisix/issues/11107#issuecomment-3212689124
@ambroslins Hello, have you tried `apisix.dns_resolver_valid`?
https://github.com/apache/apisix/blob/e90570a6eb4695af455cecca3d798283b84e1e9e/apisix/core/utils.lua#L101-110
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] feat: make dns resolution answers TTL configurable [apisix]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #11107: feat: make dns resolution answers TTL configurable
URL: https://github.com/apache/apisix/issues/11107
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] feat: make dns resolution answers TTL configurable [apisix]
Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #11107:
URL: https://github.com/apache/apisix/issues/11107#issuecomment-3226454096
> [@ambroslins](https://github.com/ambroslins) Hello, have you tried `apisix.dns_resolver_valid`?
>
> [apisix/apisix/core/utils.lua](https://github.com/apache/apisix/blob/e90570a6eb4695af455cecca3d798283b84e1e9e/apisix/core/utils.lua#L101-L110)
>
> Lines 101 to 110 in [e90570a](/apache/apisix/commit/e90570a6eb4695af455cecca3d798283b84e1e9e)
>
> local valid = table.try_read_attr(local_conf, "apisix", "dns_resolver_valid")
> local enable_resolv_search_opt = table.try_read_attr(local_conf, "apisix",
> "enable_resolv_search_opt")
> local opts = {
> nameservers = table.clone(dns_resolvers),
> order = {"last", "A", "AAAA", "CNAME"}, -- avoid querying SRV
> }
>
> opts.validTtl = valid
Hi @darkSheep404, does this method work for you?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] help request: how to set "resolver xxx(dns server) valid=10s;" for apisix upstreams [apisix]
Posted by "hanqingwu (via GitHub)" <gi...@apache.org>.
hanqingwu commented on issue #11107:
URL: https://github.com/apache/apisix/issues/11107#issuecomment-2031158839
yes, I think dns resolve is realtime , no cache valid for 10s .
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] feat: make dns resolution answers TTL configurable [apisix]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #11107:
URL: https://github.com/apache/apisix/issues/11107#issuecomment-3485019294
This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] feat: make dns resolution answers TTL configurable [apisix]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #11107:
URL: https://github.com/apache/apisix/issues/11107#issuecomment-2760804913
This issue has been marked as stale due to 350 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] feat: make dns resolution answers TTL configurable [apisix]
Posted by "ambroslins (via GitHub)" <gi...@apache.org>.
ambroslins commented on issue #11107:
URL: https://github.com/apache/apisix/issues/11107#issuecomment-3209585527
It would be nice to be able to configure the `validTtl` option for [resty.dns.client.init](https://kong.github.io/lua-resty-dns-client/modules/resty.dns.client.html#init).
I am using docker swarm, which uses a non-configurable TTL of 600s for the embedded DNS records, see [here](https://github.com/docker/compose/issues/11467). This means that after a service restart we have to wait up to 600s until the new service is discovered. In the meantime the old service might have already shutdown, which means no healthy upstream is available.
If we would be able to configure the `validTtl` option we could reduce this time and avoid downtime.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] help request: how to set "resolver xxx(dns server) valid=10s;" for apisix upstreams [apisix]
Posted by "hanqingwu (via GitHub)" <gi...@apache.org>.
hanqingwu commented on issue #11107:
URL: https://github.com/apache/apisix/issues/11107#issuecomment-2030983290
https://apisix.apache.org/docs/apisix/discovery/dns/
Does this help you?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] help request: how to set "resolver xxx(dns server) valid=10s;" for apisix upstreams [apisix]
Posted by "darkSheep404 (via GitHub)" <gi...@apache.org>.
darkSheep404 commented on issue #11107:
URL: https://github.com/apache/apisix/issues/11107#issuecomment-2031145042
> 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 ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] feat: make dns resolution answers TTL configurable [apisix]
Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #11107:
URL: https://github.com/apache/apisix/issues/11107#issuecomment-2764984069
> can not set valid=10s; to keep refresh to get lastest ip
Hi @darkSheep404, The resolved records will be cached according to their TTL. For service whose record is not in the cache, we will query it in the order of SRV -> A -> AAAA -> CNAME by default.
Can't these fulfill your usage scenarios?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] feat: make dns resolution answers TTL configurable [apisix]
Posted by "ambroslins (via GitHub)" <gi...@apache.org>.
ambroslins commented on issue #11107:
URL: https://github.com/apache/apisix/issues/11107#issuecomment-3243890351
> [@ambroslins](https://github.com/ambroslins) Hello, have you tried `apisix.dns_resolver_valid`?
>
> [apisix/apisix/core/utils.lua](https://github.com/apache/apisix/blob/e90570a6eb4695af455cecca3d798283b84e1e9e/apisix/core/utils.lua#L101-L110)
>
> Lines 101 to 110 in [e90570a](/apache/apisix/commit/e90570a6eb4695af455cecca3d798283b84e1e9e)
>
> local valid = table.try_read_attr(local_conf, "apisix", "dns_resolver_valid")
> local enable_resolv_search_opt = table.try_read_attr(local_conf, "apisix",
> "enable_resolv_search_opt")
> local opts = {
> nameservers = table.clone(dns_resolvers),
> order = {"last", "A", "AAAA", "CNAME"}, -- avoid querying SRV
> }
>
> opts.validTtl = valid
@SkyeYoung Looks like I messed up while testing this the first time. I think this setting does not affect the DNS discover and I am facing the same issue.
I found a _hacky_ solution that works for me:
```bash
sed -i '/ local opts = {/a\\ validTtl = 15,' /usr/local/apisix/apisix/discovery/dns/init.lua
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] feat: make dns resolution answers TTL configurable [apisix]
Posted by "ambroslins (via GitHub)" <gi...@apache.org>.
ambroslins commented on issue #11107:
URL: https://github.com/apache/apisix/issues/11107#issuecomment-3223378274
@SkyeYoung This works. Thanks you!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org