-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cluster: Share node HTTP address with peers
Allow each node to share its HTTP address with the rest of the cluster using node metadata that is broadcast by the memberlist library. Previously, the cluster was communicating over HTTP using the peer names (as determined automatically by their hostnames) and a hardcoded port number. Adds additional `*-advertise-addr` commandline-flags which are necessary for other cluster members to know what address to contact peers on, e.g. when binding to all interfaces or when using NAT. For simplicity, use `localhost` as the default host for all address flags, which provides a secure default. Some clustered data stores, such as Hashicorp's Consul (which uses the memberlist library) will try to detect the first available private IP when no host in specified but I found that too magic and prefer to make this configuration explicit. The memberlist library itself will try to determine the first available private IP to advertise to peers if no host is specified; I have coded defensively to prevent that from occurring as I don't wish for that behaviour to bleed into AthensDB by accident. Users must specify a hostname or IP address to advertise to other members of the cluster. The Kingpin flag library resolves the host in the `host:port` address pairs to IP addresses (as `net.TCPAddr`) and passes `tcp` as the procotol to `net.ResolveTCPAddr()`, meaning that it will try to resolve to the first available IPv4 or IPv6 address as determined by the Go's default DNS resolver.
- Loading branch information
1 parent
56703ae
commit 089d9fb
Showing
4 changed files
with
105 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters