Configuration

The cluster configuration map has the following configuration options:

Property Description
host Interface where the gateway will listen for incoming route connections.
port Port where the gateway will listen for incoming route connections.
listen Combines host and port as <host>:<port>.
tls A tls configuration map for securing the clustering connection. verify is always enabled and cert_file is used for client and server. See for certificate pitfalls.
advertise Hostport <host>:<port> to advertise how this server can be contacted by other cluster members. This is useful in setups with NAT.
no_advertise When set to ‘true’, the server will not send or gossip its client URLs to other servers in the cluster and will not tell its client about the other servers’ client URLs.
routes A list of other servers (URLs) to cluster with. Self-routes are ignored. Should authentication via token or username/password be required, specify them as part of the URL.
connect_retries After how many failed connect attempts to give up establishing a connection to a discovered route. Default is 0, do not retry. When enabled, attempts will be made once a second. This, does not apply to explicitly configured routes.
authorization Authorization map for configuring cluster routes. When token or a single username/password are used, they define the authentication mechanism this server expects. What authentication values other server have to provide when connecting. They also specify how this server will authenticate itself when establishing a connection to a discovered route. This will not be used for routes explicitly listed in routes and therefore have to be provided as part of the URL. If you use token or password based authentication, either use the same credentials throughout the system or list every route explicitly on every server. If the tls configuration map specifies verify_and_map only provide the expected username. Here different certificates can be used, but they do have to map to the same username. The authorization map also allows for timeout which is honored but users and permissions are ignored.
  1. cluster {
  2. # host/port for inbound route connections from other server
  3. listen: localhost:4244
  4. # Authorization for route connections
  5. # Other server can connect if they supply the credentials listed here
  6. # This server will connect to discovered routes using this user
  7. authorization {
  8. user: route_user
  9. password: pwd
  10. timeout: 0.5
  11. }
  12. # This server establishes routes with these server.
  13. # This server solicits new routes and Routes are actively solicited and connected to from this server.
  14. # Other servers can connect to us if they supply the correct credentials
  15. # in their routes definitions from above.
  16. routes = [
  17. nats-route://route_user:pwd@127.0.0.1:4245
  18. nats-route://route_user:pwd@127.0.0.1:4246
  19. ]
  20. }