假设在任何数据中心都有不同的网络分区(例如DMZ区域),因此一些主机集不能与其他主机集联系。因此,如果我想将消息传播到任何数据中心的所有主机,可以为用例说闲话/领事吗?
对于上述问题,我想的一个解决方案是:可以允许DMZ区域中的所有主机连接到consul服务器(仅限少数主机)。这将像某些主机集不能与其他主机集联系,但数据中心中的所有主机都可以与领事服务器通信。但我不确定,即使这样,任何消息都可以传播到数据中心的所有主机。
答案 0 :(得分:0)
Gossip仅用于consul,后者仅用于服务注册,服务发现和键/值数据 - 与配置相关。
Event 机制可能就是你想要的,来自Python文档:
Event = <class 'consul.base.Consul.Event'>
The event command provides a mechanism to fire a custom user event to
an entire datacenter. These events are opaque to Consul, but they can
be used to build scripting infrastructure to do automated deploys,
restart services, or perform any other orchestration action.
Unlike most Consul data, which is replicated using consensus, event
data is purely peer-to-peer over gossip.
This means it is not persisted and does not have a total ordering. In
practice, this means you cannot rely on the order of message delivery.
An advantage however is that events can still be used even in the
absence of server nodes or during an outage.