Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can work with dyups? #14

Open
millken opened this issue Mar 18, 2016 · 5 comments
Open

can work with dyups? #14

millken opened this issue Mar 18, 2016 · 5 comments

Comments

@millken
Copy link

millken commented Mar 18, 2016

https://github.com/yzprofile/ngx_http_dyups_module

@gfrankliu
Copy link

If DNS SRV record support can be added #3 , we may not need the dyups. When a new upstream server is added/removed, a request can be sent to update the DNS server (e.g.: Consul https://www.consul.io/ ) with DNS SRV record for IP, port, weight, etc. DNS server can even do health checks against the upstream (https://www.consul.io/docs/agent/dns.html ) so nginx will only get the "good" upstream servers.

@wandenberg
Copy link
Collaborator

@millken for now the module only check DNS changes of servers configured on conf file at startup time, there is no integration with modules like dyups.
I think that can be done in the future.

@gfrankliu I don't know much about DNS SRV record, neither about nginx DNS queries internals, but I'm pretty sure that nginx does not support it, and since we use the core functions to discover the IPs, the module does not have support either.

Do you know a client code that support it? I can take a look and see how complex is to implement the support.

@gfrankliu
Copy link

In nginx src/core/ngx_resolver.h, I see

#define NGX_RESOLVE_A         1
#define NGX_RESOLVE_CNAME     5
#define NGX_RESOLVE_PTR       12
#define NGX_RESOLVE_MX        15
#define NGX_RESOLVE_TXT       16
#if (NGX_HAVE_INET6)
#define NGX_RESOLVE_AAAA      28
#endif
#define NGX_RESOLVE_DNAME     39

I assume we can patch and add NGX_RESOLVE_SRV ?

Once we get the IP, port, weight information from the DNS resolver, we can store them for nginx to use, for upstream connection?

@gfrankliu
Copy link

Here's one example, though using lua:
https://github.com/vlipco/srv-router

@gfrankliu
Copy link

Looks like nginx itself now supports SRV using "service" along with "resolve" in upstream server config:
http://nginx.org/en/docs/http/ngx_http_upstream_module.html#service

Here is the new nginx-1.9.13/src/core/ngx_resolver.h

#define NGX_RESOLVE_A         1
#define NGX_RESOLVE_CNAME     5
#define NGX_RESOLVE_PTR       12
#define NGX_RESOLVE_MX        15
#define NGX_RESOLVE_TXT       16
#if (NGX_HAVE_INET6)
#define NGX_RESOLVE_AAAA      28
#endif
#define NGX_RESOLVE_SRV       33
#define NGX_RESOLVE_DNAME     39

I can see #define NGX_RESOLVE_SRV 33 is added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants