Documentation ¶
Overview ¶
Package cluster provides an elastic peer discovery and gossip layer.
Ingest and store instances join the same cluster and know about each other. Store instances consume segments from each ingest instance, and broadcast queries to each store instance. In the future, ingest instances will share load information to potentially refuse connections and balance writes.
Index ¶
Constants ¶
const ( // PeerTypeIngest serves the ingest API. PeerTypeIngest PeerType = "ingest" // PeerTypeStore serves the store API. PeerTypeStore = "store" // PeerTypeIngestStore serves both ingest and store APIs. PeerTypeIngestStore = "ingeststore" )
Variables ¶
This section is empty.
Functions ¶
func CalculateAdvertiseIP ¶
func CalculateAdvertiseIP(bindHost, advertiseHost string, resolver Resolver, logger log.Logger) (net.IP, error)
CalculateAdvertiseIP deduces the best IP on which to advertise our API based on a user-provided bind host and advertise host. This code lifts some logic out of the memberlist internals, and augments it with extra logic to resolve hostnames. (Memberlist demands pure IPs.)
Types ¶
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
Peer represents this node in the cluster.
func NewPeer ¶
func NewPeer( bindAddr string, bindPort int, advertiseAddr string, advertisePort int, existing []string, t PeerType, apiPort int, logger log.Logger, ) (*Peer, error)
NewPeer creates or joins a cluster with the existing peers. We will listen for cluster communications on the bind addr:port. We advertise a PeerType HTTP API, reachable on apiPort.
If advertiseAddr is not empty, we will advertise ourself as reachable for cluster communications on that address; otherwise, memberlist will extract the IP from the bound addr:port and advertise on that.
func (*Peer) ClusterSize ¶
ClusterSize returns the total size of the cluster from this node's perspective.