开发者

Can Nginx resolves upstream server name given as SRV DNS records?

开发者 https://www.devze.com 2023-03-22 07:01 出处:网络
I just want to know if Nginx is ab开发者_如何学运维le 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\

I just want to know if Nginx is ab开发者_如何学运维le 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.


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号