Nginx可以解析作为SRV DNS记录给出的上游服务器名称吗? [英] Can Nginx resolves upstream server name given as SRV DNS records?

查看:148
本文介绍了Nginx可以解析作为SRV DNS记录给出的上游服务器名称吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道Nginx作为上游服务器地址时是否能够解析SRV DNS记录.似乎并非如此,但如果无法立即执行此操作,则可能有解决方法. 提前谢谢.

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.

推荐答案

SRV记录不能像A(ddress)记录一样使用. 从理论上讲,也可以破解Nginx来解析SRV记录,但是我唯一看到的优点是SRV记录中使用的权重"和优先级"字段.

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.

您已经可以在nginx配置中使用此功能:

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

这篇关于Nginx可以解析作为SRV DNS记录给出的上游服务器名称吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆