Add a way to differentiate the listen addresses for each node of a cluster
Every Gateway node in a cluster share the same configuration and the same database.
They have the same definition of servers, including the listenAddress
.
This poses a problem, because they cannot all listen on the same IP address.
Proposed solution
Add a table in the database to override settings for a given node of the cluster.
Each node must be given a identifier unique to the cluster. The table could have the following structure:
- Cluster id = Gateway name
- Node id
- Key
- Value
- PK: (clusterid, node id, key)
The node identifier will be given as a command line argument when the server is launched, with support for an env var and a fallback on the hostname.
When a listener is started, the table is searched for an override for the node with the key listenAddress::OLDADDRESS
and the value NEWADDRESS
where:
-
OLDADDRESS
is the address to replace (typically the address of the load balancer) -
NEWADDRESS
is the address to use
Key examples:
- listenAddress::127.0.0.1
- listenAddress::lb.fully.qualified.name
- listenAddress::[67b4::92a3]
If none is found, the server's listenAddress
is used, making it possible to use other external mechanism (NAT, /etc/hosts, etc.)