问题
I just want to know if Nginx is able to resolve SRV DNS records when given as the upstream server address. It seems like it's not the case, but maybe there is a workaround if it can't do this out-of-the-box. Thx in advance.
回答1:
SRV records are not meant to be used like A(ddress) records. In theory it should be possible to hack nginx to resolve SRV records as well but the only advantage I could see is the 'weight' and 'priority' fields used in SRV records.
You can already use this feature in nginx config:
upstream backend {
server backend1.example.com weight=5;
server backend2.example.com:8080;
server unix:/tmp/backend3;
}
HttpUpstreamModule
回答2:
Free nginx does not support SRV records.
resolve
and service
keywords for upstream directive are not available in free nginx.
There are some free solutions available,
- ngx_upstream_resolveMK
- srv-router
来源:https://stackoverflow.com/questions/6769950/can-nginx-resolves-upstream-server-name-given-as-srv-dns-records