nodetool

package
v0.0.0-...-cd8f91f Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: Apache-2.0 Imports: 8 Imported by: 16

Documentation

Index

Constants

View Source
const (
	NodeOperationModeStarting       = "STARTING"
	NodeOperationModeNormal         = "NORMAL"
	NodeOperationModeJoining        = "JOINING"
	NodeOperationModeLeaving        = "LEAVING"
	NodeOperationModeDecommissioned = "DECOMMISSIONED"
	NodeOperationModeMoving         = "MOVING"
	NodeOperationModeDraining       = "DRAINING"
	NodeOperationModeDrained        = "DRAINED"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	Host   string
	ID     uuid.UUID
	State  NodeState
	Status NodeStatus
}

type NodeMap

type NodeMap map[string]*Node

type NodeOperationMode

type NodeOperationMode string

type NodeState

type NodeState string

NodeState represents the cluster membership state of a C* node.

const (
	NodeStateNormal  NodeState = "Normal"
	NodeStateLeaving NodeState = "Leaving"
	NodeStateJoining NodeState = "Joining"
	NodeStateMoving  NodeState = "Moving"
)

type NodeStatus

type NodeStatus string

NodeState represents the reachability of a C* node from the perspective of the node answering the query.

const (
	NodeStatusUnknown NodeStatus = "Unknown"
	NodeStatusUp      NodeStatus = "Up"
	NodeStatusDown    NodeStatus = "Down"
)

type Nodetool

type Nodetool struct {
	Client client.Interface
}

func New

func New(client client.Interface) *Nodetool

func NewFromURL

func NewFromURL(u *url.URL) *Nodetool

func (*Nodetool) Cleanup

func (t *Nodetool) Cleanup(keyspace string, tables []string) error

func (*Nodetool) Decommission

func (t *Nodetool) Decommission() error

func (*Nodetool) OperationMode

func (t *Nodetool) OperationMode() (NodeOperationMode, error)

OperationMode gets the Operation Mode for the specific Cassandra instance. This command is available even after the node has decommissioned.

func (*Nodetool) Status

func (t *Nodetool) Status() (NodeMap, error)

Status generates a summary of the status of every C* node in the cluster. From the perspective of the local node.

It is intended to produce identical information to the `nodetool status` utility. But it only a reports a subset of the `nodetool status` information, for now. Enough to allow Navigator to determine whether a node is Up and Normal (healthy). This function returns structured information about the Cassandra cluster health, which avoids having to parse the unstructured, human readable output of `nodetool status`. Here is an example of the parsing that we are seeking to avoid: https://github.com/kubernetes/examples/blob/b86c9d50be45eaf5ce74dee7159ce38b0e149d38/cassandra/image/files/ready-probe.sh And here is the source code for the `nodetool status`: https://github.com/apache/cassandra/blob/cassandra-3.11.2/src/java/org/apache/cassandra/tools/nodetool/Status.java

Algorithm

For every C* node that has reported its `host_id` (i.e. present in HostIdMap): * Determine the status of the node (one of live, unreachable, unknown) * Determine the state of the node (one of leaving, joining, moving, normal)

We perform additional assertions to check that a node is only present in one status and one state. If these assertions fail, we return an error so as to avoid reporting false positive status. Note: `nodetool status` does not perform these assertions.

func (*Nodetool) Version

func (t *Nodetool) Version() (*version.Version, error)

Jump to

Keyboard shortcuts

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