clustering

package
v0.0.0-...-24f4e42 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachReplicasToPrimary

func AttachReplicasToPrimary(ctx context.Context, cluster *redis.Cluster, admin redis.AdminInterface, primaryToReplicas map[string]redis.Nodes) error

AttachReplicasToPrimary used to attach replicas to their primaries

func ClassifyNodesByRole

func ClassifyNodesByRole(nodes redis.Nodes) (primaries, replicas, primariesWithNoSlots redis.Nodes)

ClassifyNodesByRole use to classify the Nodes by roles

func DispatchReplica

func DispatchReplica(ctx context.Context, cluster *redis.Cluster, nodes redis.Nodes, replicationFactor int32, admin redis.AdminInterface) error

DispatchReplica aims to dispatch the available redis to replica of the current primaries

func DispatchSlotsToNewPrimaries

func DispatchSlotsToNewPrimaries(ctx context.Context, admin redis.AdminInterface, cluster *rapi.RedisCluster, rCluster *redis.Cluster, newPrimaryNodes, currentPrimaryNodes, allPrimaryNodes redis.Nodes, scaling bool) error

DispatchSlotsToNewPrimaries used to dispatch slots to the new primary nodes

func GeneratePrimaryToReplicas

func GeneratePrimaryToReplicas(primaries, replicas redis.Nodes, replicationFactor int32) (map[string]redis.Nodes, redis.Nodes)

func GetZoneIndex

func GetZoneIndex(zones []string, primaryZone string, replicas redis.Nodes) int

func PlacePrimaries

func PlacePrimaries(cluster *redis.Cluster, currentPrimaries, candidatePrimaries redis.Nodes, nbPrimary int32) (redis.Nodes, bool, error)

PlacePrimaries selects primary redis nodes by spreading out the primaries across zones as much as possible.

func PlaceReplicas

func PlaceReplicas(cluster *redis.Cluster, primaryToReplicas map[string]redis.Nodes, newReplicas, unusedReplicas redis.Nodes, replicationFactor int32) error

PlaceReplicas selects replica redis nodes for each primary by spreading out the replicas across zones as much as possible.

func RemoveOldReplicas

func RemoveOldReplicas(oldReplicas, newReplicas redis.Nodes) redis.Nodes

func SameZone

func SameZone(zone string, nodes redis.Nodes) bool

func SelectPrimaries

func SelectPrimaries(cluster *redis.Cluster, currentPrimaries, candidatePrimaries redis.Nodes, nbPrimary int32) (redis.Nodes, error)

SelectPrimaries used to select redis nodes with primary roles

func SelectPrimariesToReplace

func SelectPrimariesToReplace(oldPrimaries, newPrimaries, newNodesNoSlots redis.Nodes, nbPrimaries, nbPrimariesToReplace int32) (redis.Nodes, redis.Nodes, error)

SelectPrimariesToReplace used to replace currentPrimaries with new redis nodes

func ZoneToNodes

func ZoneToNodes(zones []string, nodes redis.Nodes) map[string]redis.Nodes

func ZonesBalanced

func ZonesBalanced(zones []string, candidate *redis.Node, nodes redis.Nodes) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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