Documentation ¶
Index ¶
- type Node
- func (n *Node) Close() error
- func (n *Node) ClusterGetID(ctx context.Context) (string, error)
- func (n *Node) ClusterMakeReplica(ctx context.Context, targetID string) error
- func (n *Node) ClusterMeet(ctx context.Context, addr string, port, clusterBusPort int) error
- func (n *Node) ClusterPromoteForce(ctx context.Context) error
- func (n *Node) ClusterPromoteTakeover(ctx context.Context) error
- func (n *Node) DisconnectClients(ctx context.Context, ctype string) error
- func (n *Node) EmptyQuorumReplicas(ctx context.Context) error
- func (n *Node) EvaluatePing() (bool, bool)
- func (n *Node) FQDN() string
- func (n *Node) GetIP() (string, error)
- func (n *Node) GetIPs() []string
- func (n *Node) GetInfo(ctx context.Context) (map[string]string, error)
- func (n *Node) GetMinReplicas(ctx context.Context) (int, error)
- func (n *Node) GetQuorumReplicas(ctx context.Context) (string, error)
- func (n *Node) HasClusterSlots(ctx context.Context) (bool, error)
- func (n *Node) IsClusterMajorityAlive(ctx context.Context) (bool, error)
- func (n *Node) IsClusterNodeAlone(ctx context.Context) (bool, error)
- func (n *Node) IsLocal() bool
- func (n *Node) IsOffline(ctx context.Context) (bool, error)
- func (n *Node) IsReadOnly(ctx context.Context) (bool, error)
- func (n *Node) IsReplPaused(ctx context.Context) (bool, error)
- func (n *Node) MatchHost(host string) bool
- func (n *Node) PauseReplication(ctx context.Context) error
- func (n *Node) RefreshAddrs() error
- func (n *Node) Restart(ctx context.Context) error
- func (n *Node) ResumeReplication(ctx context.Context) error
- func (n *Node) SentinelMakeReplica(ctx context.Context, target string) error
- func (n *Node) SentinelPromote(ctx context.Context) error
- func (n *Node) SetMinReplicas(ctx context.Context, value int) (error, error)
- func (n *Node) SetOffline(ctx context.Context) error
- func (n *Node) SetOnline(ctx context.Context) error
- func (n *Node) SetQuorumReplicas(ctx context.Context, value string) (error, error)
- func (n *Node) SetReadOnly(ctx context.Context, disconnect bool) (error, error)
- func (n *Node) String() string
- type NodeConfiguration
- type SentiCacheMaster
- type SentiCacheNode
- type SentiCacheReplica
- type SentiCacheSentinel
- type SentiCacheState
- type Shard
- func (s *Shard) Close()
- func (s *Shard) Get(host string) *Node
- func (s *Shard) GetNodeConfiguration(host string) (*NodeConfiguration, error)
- func (s *Shard) GetShardHostsFromDcs() ([]string, error)
- func (s *Shard) Hosts() []string
- func (s *Shard) Local() *Node
- func (s *Shard) UpdateHostsInfo() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents API to query/manipulate a single Redis node
func (*Node) ClusterGetID ¶
ClusterGetID returns cluster node id of node
func (*Node) ClusterMakeReplica ¶
ClusterMakeReplica makes node replica of target in cluster mode
func (*Node) ClusterMeet ¶
ClusterMeet makes replica join the cluster
func (*Node) ClusterPromoteForce ¶
ClusterPromoteForce makes node primary in cluster mode if master/majority of masters is reachable
func (*Node) ClusterPromoteTakeover ¶
ClusterPromoteTakeover makes node primary in cluster mode if majority of masters is not reachable
func (*Node) DisconnectClients ¶
DisconnectClients disconnects all connected clients with specified type
func (*Node) EmptyQuorumReplicas ¶
EmptyQuorumReplicas sets quorum replicas to empty value (as it should be on replicas)
func (*Node) EvaluatePing ¶
func (*Node) GetMinReplicas ¶
GetMinReplicas returns number of connected replicas to accept writes on node
func (*Node) GetQuorumReplicas ¶
GetQuorumReplicas returns a set of quorum replicas
func (*Node) HasClusterSlots ¶
HasClusterSlots checks if node has any slot assigned
func (*Node) IsClusterMajorityAlive ¶
IsClusterMajorityAlive checks if majority of masters in cluster are not failed
func (*Node) IsClusterNodeAlone ¶
IsClusterNodeAlone checks if node sees only itself
func (*Node) IsLocal ¶
IsLocal returns true if Node running on the same host as calling rdsync process
func (*Node) IsReadOnly ¶
IsReadOnly returns ReadOnly status for node
func (*Node) IsReplPaused ¶
IsReplPaused returns pause status of replication on node
func (*Node) PauseReplication ¶
PauseReplication pauses replication from master on node
func (*Node) RefreshAddrs ¶
RefreshAddrs updates internal ip address list if ttl exceeded
func (*Node) ResumeReplication ¶
ResumeReplication starts replication from master on node
func (*Node) SentinelMakeReplica ¶
SentinelMakeReplica makes node replica of target in sentinel mode
func (*Node) SentinelPromote ¶
SentinelPromote makes node primary in sentinel mode
func (*Node) SetMinReplicas ¶
SetMinReplicas sets desired number of connected replicas to accept writes on node
func (*Node) SetOffline ¶
SetOffline disallows non-localhost connections and drops all existing clients (except rdsync ones)
func (*Node) SetQuorumReplicas ¶
SetQuorumReplicas sets desired quorum replicas
func (*Node) SetReadOnly ¶
SetReadOnly makes node read-only by setting min replicas to unreasonably high value and disconnecting clients
type NodeConfiguration ¶
type NodeConfiguration struct { // Priority - is a host priority to become master. Can be changed via CLI. Priority int `json:"priority"` }
NodeConfiguration is a dcs node configuration for redis replica
func DefaultNodeConfiguration ¶
func DefaultNodeConfiguration() *NodeConfiguration
DefaultNodeConfiguration returns default node configuration (matches upstream sentinel settings)
type SentiCacheMaster ¶
type SentiCacheMaster struct { Name string IP string Port int RunID string Quorum int ParallelSyncs int ConfigEpoch uint64 }
SentiCacheMaster represents the redis master as seen by senticache
type SentiCacheNode ¶
type SentiCacheNode struct {
// contains filtered or unexported fields
}
SentiCacheNode represents API to query/manipulate a single Redis SentiCache node
func NewSentiCacheNode ¶
NewSentiCacheNode is a SentiCacheNode constructor
func (*SentiCacheNode) Close ¶
func (s *SentiCacheNode) Close() error
Close closes underlying Redis connection
func (*SentiCacheNode) Update ¶
func (s *SentiCacheNode) Update(ctx context.Context, state *SentiCacheState) error
Update sets in-memory state of senticache
type SentiCacheReplica ¶
type SentiCacheReplica struct { IP string Port int RunID string MasterLinkDownTime int64 SlavePriority int ReplicaAnnounced int MasterHost string MasterPort int SlaveMasterLinkStatus int SlaveReplOffset int64 }
SentiCacheReplica represents the redis replica as seen by senticache
type SentiCacheSentinel ¶
SentiCacheSentinel represents the "other" senticache in senticache
type SentiCacheState ¶
type SentiCacheState struct { Master SentiCacheMaster Replicas []SentiCacheReplica Sentinels []SentiCacheSentinel }
SentiCacheState represents the desired senticache state
type Shard ¶
Shard contains a set of Redis nodes
func (*Shard) GetNodeConfiguration ¶
func (s *Shard) GetNodeConfiguration(host string) (*NodeConfiguration, error)
GetNodeConfiguration returns current node configuration from dcs
func (*Shard) GetShardHostsFromDcs ¶
GetShardHostsFromDcs returns current shard hosts from dcs state
func (*Shard) UpdateHostsInfo ¶
UpdateHostsInfo reads host names from DCS and updates shard state