我在AWS上托管了一组微服务,这些服务使用路由53上定义的DNS名称通过请求/响应相互交互,我在其中创建了一个名为api.io
的新私有区域并定义了DNS例如WSG_KAFKA
,在我的代码中,我使用区域名称WSG_KAFKA.api.io
配置DNS名称
是否有任何方法可以忽略域名api.io
并直接使用DNS名称
答案 0 :(得分:1)
要直接使用主机名,您需要修改/etc/resolv.conf
并添加search api.io
选项,这样您的文件可能如下所示:
search api.io
nameserver 10.0.0.2
只需使用WSG_KAFKA
即可帮助您搜索主机名。
来自男人resolv.conf:
search Search list for host-name lookup.
The search list is normally determined from the local domain
name; by default, it contains only the local domain name.
This may be changed by listing the desired domain search path
following the search keyword with spaces or tabs separating
the names. Resolver queries having fewer than ndots dots
(default is 1) in them will be attempted using each component
of the search path in turn until a match is found. For
environments with multiple subdomains please read options
ndots:n below to avoid man-in-the-middle attacks and
unnecessary traffic for the root-dns-servers. Note that this
process may be slow and will generate a lot of network traffic
if the servers for the listed domains are not local, and that
queries will time out if no server is available for one of the
domains.
The search list is currently limited to six domains with a
total of 256 characters.