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.
Here --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.
The 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 N
routes.