cagrr

package module
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2017 License: BSD-3-Clause Imports: 16 Imported by: 1

README

Cassandra Repair Scheduler

Build Status Go Report Card Coverage Status

Anti-entropy Cassandra cluster tool. It uses repair service written in Java.

Prerequisites

You need cajrr up and running.

Run tests:

make integration   # Make a "hole" and check existence
make check         # Only check, no write/restart cycle

Repair your cluster:

cagrr -k keyspace

Analyze your logs in Kibana interface available at:

http://172.16.237.50:5601

Check your metrics in Grafana interface available at:

http://172.16.237.30:3000

##Troubleshooting

  1. Elasticsearch didn't start with vm.max_map_count error:

    Run on your host machine:

    sudo sysctl -w vm.max_map_count=262144
    

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Closer added in v0.8.0

type Closer interface {
	Close()
}

Closer closes DB connection

type Cluster added in v0.8.0

type Cluster struct {
	ID        int
	Name      string      `yaml:"name"`
	Interval  string      `yaml:"interval"`
	Keyspaces []*Keyspace `yaml:"keyspaces"`
	Host      string
	Port      int
	// contains filtered or unexported fields
}

Cluster contains configuration of cluster item

func (*Cluster) RegulateWith added in v0.8.0

func (c *Cluster) RegulateWith(r Regulator) Scheduler

RegulateWith given rate limiter

func (*Cluster) RunRepair added in v0.8.5

func (c *Cluster) RunRepair(repair *Repair) error

RunRepair runs fragment repair

func (*Cluster) Schedule added in v0.8.0

func (c *Cluster) Schedule()

Schedule cluster repair

func (*Cluster) TrackIn added in v0.8.0

func (c *Cluster) TrackIn(t Tracker) Scheduler

TrackIn given tracker

func (*Cluster) Until added in v0.8.5

func (c *Cluster) Until(done chan bool) Scheduler

Until sets chan for done event

type ClusterStats added in v0.8.0

type ClusterStats struct {
	Cluster            string
	ClusterDuration    time.Duration
	LastClusterSuccess time.Time
}

ClusterStats for logging

type Config

type Config struct {
	BufferLength int        `yaml:"buffer"`
	Clusters     []*Cluster `yaml:"clusters"`
}

Config is a configuration file struct

func ReadConfiguration added in v0.8.0

func ReadConfiguration(filename string) (*Config, error)

ReadConfiguration parses yaml configuration file

type DB added in v0.8.0

type DB interface {
	CreateKey(keys ...string) string
	ValueReader
	ValueWriter
	Closer
}

DB implements DB interface

func NewConsulDb added in v0.8.0

func NewConsulDb() DB

NewConsulDb connects to DB

func NewRedisDb added in v0.8.0

func NewRedisDb(addr, password string, db int) DB

NewRedisDb connects to DB

type DurationQueue added in v0.8.0

type DurationQueue interface {
	Push(time.Duration)
	Pop() time.Duration
	Len() int
	Average() time.Duration
}

DurationQueue is a fixed size FIFO queue of durations

func NewQueue added in v0.8.0

func NewQueue(size int) DurationQueue

NewQueue returns a new queue with the given initial size.

type Fragment

type Fragment struct {
	ID       int `json:"id"`
	Endpoint string
	Start    string
	End      string
}

Fragment of Token range for repair

type Keyspace added in v0.8.0

type Keyspace struct {
	Name string `yaml:"name"`
	// contains filtered or unexported fields
}

Keyspace contains keyspace repair schedule description

func (*Keyspace) SetTables added in v0.8.0

func (k *Keyspace) SetTables(tables []*Table)

SetTables to keyspace

func (*Keyspace) SetTotal added in v0.8.0

func (k *Keyspace) SetTotal(total int)

SetTotal to keyspace

func (*Keyspace) Tables added in v0.8.0

func (k *Keyspace) Tables() []*Table

Tables of keyspace

func (*Keyspace) Total added in v0.8.0

func (k *Keyspace) Total() int

Total repairs in keyspace

type Logger added in v0.8.0

type Logger interface {
	WithError(err error) Logger
	WithFields(str interface{}) Logger
	Debug(message interface{}) Logger
	Error(message interface{}) Logger
	Fatal(message interface{}) Logger
	Warn(message interface{}) Logger
	Info(message interface{}) Logger
}

Logger logs messages

func NewLogger added in v0.8.0

func NewLogger(verb, filename string) Logger

NewLogger cretes an implementation of Logger

type Regulator added in v0.8.0

type Regulator interface {
	LimitRateTo(key string, duration time.Duration) time.Duration
	Limit(key string)
	Rate(key string) time.Duration
}

Regulator moderates the process

func NewRegulator added in v0.8.0

func NewRegulator(size int) Regulator

NewRegulator initializes new stability service object

type Repair

type Repair struct {
	ID       int    `json:"id"`
	Cluster  string `json:"cluster"`
	Keyspace string `json:"keyspace"`
	Table    string `json:"table"`
	Endpoint string `json:"endpoint"`
	Start    string `json:"start"`
	End      string `json:"end"`
}

Repair object

type RepairStats added in v0.8.0

type RepairStats struct {
	Cluster            string
	Keyspace           string
	Table              string
	ID                 int
	Duration           time.Duration
	Rate               time.Duration
	TableTotal         int
	TableCompleted     int
	TablePercent       float32
	TableDuration      time.Duration
	TableAverage       time.Duration
	TableEstimate      time.Duration
	KeyspaceTotal      int
	KeyspaceCompleted  int
	KeyspacePercent    float32
	KeyspaceDuration   time.Duration
	KeyspaceAverage    time.Duration
	KeyspaceEstimate   time.Duration
	ClusterTotal       int
	ClusterCompleted   int
	ClusterPercent     float32
	ClusterDuration    time.Duration
	ClusterAverage     time.Duration
	ClusterEstimate    time.Duration
	LastClusterSuccess time.Time
}

RepairStats for logging

type RepairStatus

type RepairStatus struct {
	Repair  Repair
	Message string
	Type    string
}

RepairStatus keeps status of repair

type Scheduler added in v0.8.0

type Scheduler interface {
	RegulateWith(Regulator) Scheduler
	Schedule()
	TrackIn(Tracker) Scheduler
	Until(chan bool) Scheduler
}

Scheduler creates jobs in time

type Server added in v0.8.0

type Server interface {
	ServeAt(callback string) Server
}

Server serves repair handlers

func NewServer added in v0.8.0

func NewServer(tracker Tracker) Server

NewServer initializes loops for scheduling repair jobs

type Table added in v0.8.0

type Table struct {
	Name   string  `yaml:"name"`
	Size   int64   `yaml:"size"`
	Slices int     `yaml:"slices"`
	Weight float32 `yaml:"weight"`
	// contains filtered or unexported fields
}

Table contains column families to repair

func (*Table) Repairs added in v0.8.0

func (t *Table) Repairs() []*Repair

Repairs of table

func (*Table) SetRepairs added in v0.8.0

func (t *Table) SetRepairs(repairs []*Repair)

SetRepairs to table

func (*Table) SetTotal added in v0.8.0

func (t *Table) SetTotal(total int)

SetTotal to table

func (*Table) Total added in v0.8.0

func (t *Table) Total() int

Total repairs in table

type Token

type Token struct {
	ID     string `json:"id"`
	Ranges []Fragment
}

Token represents cassandra key range

type TokenSet added in v0.8.0

type TokenSet []Token

TokenSet is a set of Token

type Track added in v0.8.0

type Track struct {
	Completed bool
	Count     int
	Total     int
	Percent   float32
	Duration  time.Duration
	Average   time.Duration
	Estimate  time.Duration
	Rate      time.Duration
	Finished  time.Time
	Started   time.Time
}

Track of repair item

func (*Track) CheckCompletion added in v0.8.0

func (t *Track) CheckCompletion()

CheckCompletion of repair

func (*Track) Complete added in v0.8.0

func (t *Track) Complete(duration time.Duration) (int, int, time.Duration, float32, time.Duration, time.Duration)

Complete repair fragment

func (*Track) IsNew added in v0.8.0

func (t *Track) IsNew() bool

IsNew object

func (*Track) IsRepaired added in v0.8.0

func (t *Track) IsRepaired(threshold time.Duration) bool

IsRepaired is check for repair completeness

func (*Track) IsSpoiled added in v0.8.0

func (t *Track) IsSpoiled(threshold time.Duration) bool

IsSpoiled checks that repair stinks

func (*Track) Restart added in v0.8.0

func (t *Track) Restart()

Restart track

func (*Track) Skip added in v0.8.0

func (t *Track) Skip()

Skip track

func (*Track) Start added in v0.8.0

func (t *Track) Start(total int)

Start track

type Tracker added in v0.8.0

type Tracker interface {
	Complete(cluster, keyspace, table string, repair int) *RepairStats
	IsCompleted(cluster, keyspace, table string, repair int, threshold time.Duration) bool
	Restart(cluster, keyspace, table string, repair int)
	Skip(cluster, keyspace, table string, repair int)
	Start(cluster, keyspace, table string, repair int)
	StartTable(cluster, keyspace, table string, total int)
	StartKeyspace(cluster, keyspace string, total int)
	StartCluster(cluster string, total int)
}

Tracker keeps progress of repair

func NewTracker added in v0.8.0

func NewTracker(db DB, r Regulator) Tracker

NewTracker created new progress tracker

type ValueReader added in v0.8.0

type ValueReader interface {
	ReadValue(string, string) []byte
}

ValueReader reads position data from DB

type ValueWriter added in v0.8.0

type ValueWriter interface {
	WriteValue(string, string, []byte) error
}

ValueWriter writes position to DB

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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