failover

package
v0.0.0-...-bdcd3c7 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisFailover

type RedisFailover struct {
	// contains filtered or unexported fields
}

func NewRedisFailover

func NewRedisFailover(k8sService k8s.Services, redisClient redis.Client) *RedisFailover

NewRedisFailoverHandler returns a new RedisFailover

func (*RedisFailover) CheckAndHeal

func (r *RedisFailover) CheckAndHeal(rf *redisv1alpha1.Redis) error

type RedisFailoverCheck

type RedisFailoverCheck interface {
	CheckAllSlavesFromMaster(master string, r *redisv1alpha1.Redis) error
	CheckSentinelNumberInMemory(sentinel string, r *redisv1alpha1.Redis) error
	CheckSentinelSlavesNumberInMemory(sentinel string, r *redisv1alpha1.Redis) error
	CheckSentinelMonitor(sentinel string, monitor string) error
	GetMasterIP(r *redisv1alpha1.Redis) (string, error)
	GetNumberMasters(r *redisv1alpha1.Redis) (int, error)
	GetRedisesIPs(r *redisv1alpha1.Redis) ([]string, error)
	GetSentinelsIPs(r *redisv1alpha1.Redis) ([]string, error)
	GetMinimumRedisPodTime(r *redisv1alpha1.Redis) (time.Duration, error)
}

RedisFailoverCheck defines the interface able to check the correct status of a redis cluster

type RedisFailoverChecker

type RedisFailoverChecker struct {
	// contains filtered or unexported fields
}

RedisFailoverChecker is our implementation of RedisFailoverCheck interface

func NewRedisFailoverChecker

func NewRedisFailoverChecker(k8sService k8s.Services, redisClient redis.Client) *RedisFailoverChecker

NewRedisFailoverChecker creates an object of the RedisFailoverChecker struct

func (*RedisFailoverChecker) CheckAllSlavesFromMaster

func (rfc *RedisFailoverChecker) CheckAllSlavesFromMaster(master string, r *redisv1alpha1.Redis) error

CheckAllSlavesFromMaster controls that all slaves have the same master (the real one)

func (*RedisFailoverChecker) CheckSentinelMonitor

func (rfc *RedisFailoverChecker) CheckSentinelMonitor(sentinel string, monitor string) error

CheckSentinelMonitor controls if the sentinels are monitoring the expected master

func (*RedisFailoverChecker) CheckSentinelNumberInMemory

func (rfc *RedisFailoverChecker) CheckSentinelNumberInMemory(sentinel string, r *redisv1alpha1.Redis) error

CheckSentinelNumberInMemory controls that the provided sentinel has only the living sentinels on its memory.

func (*RedisFailoverChecker) CheckSentinelSlavesNumberInMemory

func (rfc *RedisFailoverChecker) CheckSentinelSlavesNumberInMemory(sentinel string, r *redisv1alpha1.Redis) error

CheckSentinelSlavesNumberInMemory controls that the provided sentinel has only the expected slaves number.

func (*RedisFailoverChecker) GetMasterIP

func (rfc *RedisFailoverChecker) GetMasterIP(r *redisv1alpha1.Redis) (string, error)

GetMasterIP connects to all redis and returns the master of the redis failover

func (*RedisFailoverChecker) GetMinimumRedisPodTime

func (rfc *RedisFailoverChecker) GetMinimumRedisPodTime(r *redisv1alpha1.Redis) (time.Duration, error)

GetMinimumRedisPodTime returns the minimum time a pod is alive

func (*RedisFailoverChecker) GetNumberMasters

func (rfc *RedisFailoverChecker) GetNumberMasters(r *redisv1alpha1.Redis) (int, error)

GetNumberMasters returns the number of redis nodes that are working as a master

func (*RedisFailoverChecker) GetRedisesIPs

func (rfc *RedisFailoverChecker) GetRedisesIPs(r *redisv1alpha1.Redis) ([]string, error)

GetRedisesIPs returns the IPs of the Redis nodes

func (*RedisFailoverChecker) GetSentinelsIPs

func (rfc *RedisFailoverChecker) GetSentinelsIPs(r *redisv1alpha1.Redis) ([]string, error)

GetSentinelsIPs returns the IPs of the Sentinel nodes

type RedisFailoverHeal

type RedisFailoverHeal interface {
	MakeMaster(ip string) error
	SetOldestAsMaster(r *redisv1alpha1.Redis) error
	SetMasterOnAll(masterIP string, r *redisv1alpha1.Redis) error
	NewSentinelMonitor(ip string, monitor string, r *redisv1alpha1.Redis) error
	RestoreSentinel(ip string) error
	SetSentinelCustomConfig(ip string, r *redisv1alpha1.Redis) error
	SetRedisCustomConfig(ip string, r *redisv1alpha1.Redis) error
}

RedisFailoverHeal defines the interface able to fix the problems on the redis cluster

type RedisFailoverHealer

type RedisFailoverHealer struct {
	// contains filtered or unexported fields
}

RedisFailoverHealer is our implementation of RedisFailoverHeal interface

func NewRedisFailoverHealer

func NewRedisFailoverHealer(k8sService k8s.Services, redisClient redis.Client) *RedisFailoverHealer

NewRedisFailoverHealer creates an object of the RedisFailoverHeal struct

func (*RedisFailoverHealer) MakeMaster

func (rfh *RedisFailoverHealer) MakeMaster(ip string) error

func (*RedisFailoverHealer) NewSentinelMonitor

func (rfh *RedisFailoverHealer) NewSentinelMonitor(ip string, monitor string, r *redisv1alpha1.Redis) error

NewSentinelMonitor changes the master that Sentinel has to monitor

func (*RedisFailoverHealer) RestoreSentinel

func (rfh *RedisFailoverHealer) RestoreSentinel(ip string) error

RestoreSentinel clear the number of sentinels on memory

func (*RedisFailoverHealer) SetMasterOnAll

func (rfh *RedisFailoverHealer) SetMasterOnAll(masterIP string, r *redisv1alpha1.Redis) error

SetMasterOnAll puts all redis nodes as a slave of a given master

func (*RedisFailoverHealer) SetOldestAsMaster

func (rfh *RedisFailoverHealer) SetOldestAsMaster(r *redisv1alpha1.Redis) error

SetOldestAsMaster puts all redis to the same master, choosen by order of appearance

func (*RedisFailoverHealer) SetRedisCustomConfig

func (rfh *RedisFailoverHealer) SetRedisCustomConfig(ip string, r *redisv1alpha1.Redis) error

SetRedisCustomConfig will call redis to set the configuration given in config

func (*RedisFailoverHealer) SetSentinelCustomConfig

func (rfh *RedisFailoverHealer) SetSentinelCustomConfig(ip string, r *redisv1alpha1.Redis) error

SetSentinelCustomConfig will call sentinel to set the configuration given in config

Jump to

Keyboard shortcuts

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