gpt4 book ai didi

dns - 访问部署在 apache mesos 代理上的微服务

转载 作者:行者123 更新时间:2023-12-02 08:24:50 24 4
gpt4 key购买 nike

客户端如何在不指定主机代理 IP 地址和相关映射端口的情况下访问已部署的微服务。

如果我们添加 Mesos-DNS 作为客户端解析器,我们只能获取代理 IP 地址,但不会返回微服务实例及其相关端口的列表。

假设我们有如下三个 webapp1 实例:

+---------+---------+
| agent1 | agent2 |
+---------+---------+
| | |
| ins1:11 | ins3:13 |
| | |
| ins2:12 | |
| | |
+---------+---------+

客户端应能够直接访问其中一个实例(无需引用agent1和agent2 IP地址或11、12和13端口号)。例如:

$ lynx webapp1.marathon.mesos

最佳答案

看看this answer

当您创建 DNS SRV 时,DNS 可以提供有关服务端口的信息要求。它与大多数客户端不兼容,因此您需要手动。 Mesos DNS 有 whole section dedicate to SRV records

以下是文档中的示例:

SRV Records

An SRV record associates a service name to a hostname and an IP port. For task task launched by framework framework, Mesos-DNS generates an SRV record for service name _task._protocol.framework.domain, where protocol is udp or tcp. For example, other Mesos tasks can discover service search launched by the marathon framework with a lookup for lookup _search._tcp.marathon.mesos:

$ dig _search._tcp.marathon.mesos SRV

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> _search._tcp.marathon.mesos SRV
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33793
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;_search._tcp.marathon.mesos. IN SRV

;; ANSWER SECTION:
_search._tcp.marathon.mesos. 60 IN SRV 0 0 31302 10.254.132.41.

Mesos-DNS supports the use of a task's DiscoveryInfo for SRV record generation. If no DiscoveryInfo is available then Mesos-DNS will fall back to those "ports" resources allocated for the task. The following table illustrates the rules that govern SRV generation:

关于dns - 访问部署在 apache mesos 代理上的微服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42527724/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com