cluster

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

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

View Source
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 CalculateAdvertiseAddress added in v0.2.2

func CalculateAdvertiseAddress(bindAddr, advertiseAddr string) (net.IP, error)

CalculateAdvertiseAddress attempts to clone logic from deep within memberlist (NetTransport.FinalAdvertiseAddr) in order to surface its conclusions to the application, so we can provide more actionable error messages if the user has inadvertantly misconfigured their cluster.

https://github.com/hashicorp/memberlist/blob/022f081/net_transport.go#L126

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

func (p *Peer) ClusterSize() int

ClusterSize returns the total size of the cluster from this node's perspective.

func (*Peer) Current

func (p *Peer) Current(t PeerType) []string

Current API host:ports for the given type of node.

func (*Peer) Leave

func (p *Peer) Leave(timeout time.Duration) error

Leave the cluster, waiting up to timeout.

func (*Peer) Name

func (p *Peer) Name() string

Name returns the unique ID of this peer in the cluster.

func (*Peer) State

func (p *Peer) State() map[string]interface{}

State returns a JSON-serializable dump of cluster state. Useful for debug.

type PeerType

type PeerType string

PeerType enumerates the types of nodes in the cluster.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL