sentinel

package
v1.11.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const NAME_PREFIX = "rds-"

NAME_PREFIX used for instance name generation

Variables

This section is empty.

Functions

func CheckQuorum

func CheckQuorum(sCfg *SentinelConfig, instanceID int) (string, bool)

CheckQuorum checks if the current Sentinel configuration is able to reach the quorum needed to failover a master, and the majority needed to authorize the failover

func Failover

func Failover(sCfg *SentinelConfig, instanceID int) error

Failover sends FAILOVER command to Sentinel

func GetMasterIP

func GetMasterIP(sCfg *SentinelConfig, instanceID int) (string, error)

GetMasterIP returns master IP

func IsSentinelMonitors

func IsSentinelMonitors(sCfg *SentinelConfig, instanceID int) bool

IsSentinelMonitors returns true if instance already monitored by Sentinel

func Monitor

func Monitor(sCfg *SentinelConfig, iCfg *InstanceConfig) error

Monitor adds instance to Sentinel monitoring

func Remove

func Remove(sCfg *SentinelConfig, instanceID int) error

Remove removes instance from Sentinel monitoring

func Reset

func Reset(sCfg *SentinelConfig) error

Reset sends RESET command to Sentinel

Types

type Auth

type Auth struct {
	User     string
	Password string
}

Auth contains info for authorization

func (Auth) IsEmpty

func (a Auth) IsEmpty() bool

IsEmpty returns true if auth data is empty

type Info

type Info struct {
	Master    InfoSlice
	Replicas  []InfoSlice
	Sentinels []InfoSlice
}

Info contains info about all Sentinels and Redis instances

func GetInfo

func GetInfo(sCfg *SentinelConfig, instanceID int) (*Info, error)

GetInfo returns info about master, replicas and sentinels

type InfoItem

type InfoItem struct {
	Name  string
	Value string
}

InfoItem is info key/value struct

type InfoSlice

type InfoSlice []InfoItem

type InstanceConfig

type InstanceConfig struct {
	ID   int
	IP   string
	Port int

	Quorum                int
	DownAfterMilliseconds int
	FailoverTimeout       int
	ParallelSyncs         int

	Auth Auth
}

InstanceConfig contains info about instance for Sentinel monitoring

type SentinelConfig

type SentinelConfig struct {
	Port int

	Auth Auth
}

Jump to

Keyboard shortcuts

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