Running multiple active publishers on a NATS cluster for failover while avoding message duplication
NATS is an excellent, clustered, full-mesh PubSub messaging system, highly performant and a cakewalk to setup. Full mesh means every node (servers and clients) knows about every other node, which is great, but makes it tricky to have multiple publishers on hot standby, for high availability of publishers (not the NATS network), while avoiding duplicate pubs.
--no-advertise comes in handy if we're willing to sacrifice the automatic meshing and discovery mechanism. This may be acceptable in setups where only a fixed set of NATS servers run in a cluster and whose addresses (either IPs or hostnames) are known.
gnatsd --no-advertise flag makes a NATS server not advertise itself automatically to the mesh. For other nodes to discover
--no-advertise nodes, the
--routes have to be explicitly specified. If there are
N servers, there should be