myredis

package
v0.0.0-...-1107578 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2018 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	G_Redis_BigKey_Format_Data   string = "%-2d, %-10d, %-10d, %-6s, %-19s, %-10d, %-20s, %-20s\n"
	G_Redis_BigKey_Format_Header string = "%-2s, %-10s, %-10s, %-6s, %-19s, %-10s, %-20s, %-20s\n"
)
View Source
const (
	CRoleMaster      uint8 = 0
	CRoleSlave       uint8 = 1
	CRoleMasterSlave uint8 = 2
)

Variables

View Source
var (
	G_regexp_info_keyspace_db       *regexp.Regexp = regexp.MustCompile(`db\d+`)
	G_regexp_info_replication_slave *regexp.Regexp = regexp.MustCompile(`slave\d+`)
)
View Source
var (
	G_Redis_BigKey_Headers []string = []string{"db", "sizeInByte", "elementCnt", "type", "expire", "bigSize", "key", "big"}
)

Functions

func CompareRedisVersionInt

func CompareRedisVersionInt(a, b []uint8) (int, error)

func CompareRedisVersionStr

func CompareRedisVersionStr(a, b string) (int, error)

func GetAllMastersAddr

func GetAllMastersAddr(sarr map[string]*ClusterNodeInfo) []string

func GetAllSlavesAddr

func GetAllSlavesAddr(sarr map[string]*ClusterNodeInfo) []string

func GetClusterNodesAddr

func GetClusterNodesAddr(client *redis.ClusterClient) (map[string]RedisAddr, error)

func GetClusterNodesInfo

func GetClusterNodesInfo(client *redis.ClusterClient) (map[string]*ClusterNodeInfo, error)

name addr flags role ping_sent ping_recv config_epoch link_status slots 37328e760f7c5ca1f0430cd59bb6fcae7099e3aa 10.199.203.210:6681 myself,master - 0 0 7 connected 2731-5460 06934f9263df8e6292d2accecef2a6cabc5193a8 10.199.203.210:6683 slave 9fd094136d8ae049dcf8f8e4ff833015ce9186a9 0 1512612681090 13 connected 2725ea3036cd2948d45d82fb8b192b91805b1fbb 10.201.42.179:8209 myself,master - 0 0 1 connected 6823-8191 [6823->-b73527c7435d8b104709dd644c39b0e06ffce96b] b73527c7435d8b104709dd644c39b0e06ffce96b 10.201.41.189:8219 myself,master - 0 0 30 connected [6823-<-2725ea3036cd2948d45d82fb8b192b91805b1fbb]

cc6ef7526eb0fda69db23fcfe035d1218e8cca72 172.27.25.35:7003@17003 slave 2a1ada71bb3072fe746f1d73732cd8b094fb05c6 0 1526287370672 4 connected c5aa4190b7990f42ef5c0789f0b3405e97e6be99 172.27.25.35:7001@17001 master - 0 1526287370000 2 connected 5461-10922

key = host:port

func GetInfoStringForNodes

func GetInfoStringForNodes(prefixMsg string, nodes map[string]*RedisServer, masters map[string]*RedisServer) string

func GetInfoStringOnlyOneNode

func GetInfoStringOnlyOneNode(node *RedisServer, masters map[string]*RedisServer) string

func GetInfoStringOnlyOneSlaveAndMaster

func GetInfoStringOnlyOneSlaveAndMaster(ifSlaveFirst bool, slave, master *RedisServer) string

func GetLatestSlaveOfMasters

func GetLatestSlaveOfMasters(masters []string) (map[string]string, []string, []string, error)

func GetMemUseSampleNotString

func GetMemUseSampleNotString(keys map[string]int64, sampleRate int64, minNumb int64) map[string]int

keys: keyname=>elementCnt

func GetRedisAddr

func GetRedisAddr(host string, port int) string

func GetRedisBigkeyHeader

func GetRedisBigkeyHeader() string

func GetStringKeySample

func GetStringKeySample(keys []string) map[string]int

func ParseDBkeyspce

func ParseDBkeyspce(line string) (uint64, uint64, float64, error)

func ParseInfoClient

func ParseInfoClient(result map[string]string, info *RedisInfoAll)

func ParseInfoKeyspace

func ParseInfoKeyspace(result map[string]string, info *RedisInfoAll)

func ParseInfoMemory

func ParseInfoMemory(result map[string]string, info *RedisInfoAll)

func ParseInfoPersistent

func ParseInfoPersistent(result map[string]string, info *RedisInfoAll)

func ParseInfoReplication

func ParseInfoReplication(result map[string]string, info *RedisInfoAll)

func ParseInfoSever

func ParseInfoSever(result map[string]string, info *RedisInfoAll)

func ParseInfoStats

func ParseInfoStats(result map[string]string, info *RedisInfoAll)

func ParseMasterReplStatus

func ParseMasterReplStatus(sts map[string]string) map[string]*RedisReplStatus

func ParseRedisVersion

func ParseRedisVersion(version string) ([]uint8, error)

func ProcessArrayOfStringSliceCmdResultSameKey

func ProcessArrayOfStringSliceCmdResultSameKey(cmdArr []*redis.StringSliceCmd, result *RedisValueList, ifBytes, ifValue bool) error

func ProcessOneStringSliceCmdResult

func ProcessOneStringSliceCmdResult(cmd *redis.StringSliceCmd, result *RedisValueList, ifBytes, ifValue bool) error

func ProcessOneZsliceResult

func ProcessOneZsliceResult(cmd *redis.ZSliceCmd, result *RedisValueZset, ifBytes, ifValue bool) error

func ProcessZsliceResultArrayButSameKey

func ProcessZsliceResultArrayButSameKey(cmdArr []*redis.ZSliceCmd, result *RedisValueZset, ifBytes, ifValue bool) error

func ScanRedisKeys

func ScanRedisKeys(client *redis.Client, scanCnt int64, matchRe *regexp.Regexp, sleepCnt int, sleepTime int, keysChan chan string) error

Types

type ClusterAndRedisClient

type ClusterAndRedisClient struct {
	Redis     *redis.Client
	Cluster   *redis.ClusterClient
	IsCluster bool
}

func GetClusterOrRedisClient

func GetClusterOrRedisClient(cfg ConfCommon, addrs []string, readOnly bool, db int, isCluster bool) (ClusterAndRedisClient, error)

func (ClusterAndRedisClient) CheckIfCluster

func (client ClusterAndRedisClient) CheckIfCluster() (bool, error)

func (ClusterAndRedisClient) Close

func (client ClusterAndRedisClient) Close()

func (ClusterAndRedisClient) DeleteKeyList

func (client ClusterAndRedisClient) DeleteKeyList(key string, length int64, eachCnt int64, elementBatch int64,
	elementInterval time.Duration, ifSleep bool) error

func (ClusterAndRedisClient) DeleteKeyString

func (client ClusterAndRedisClient) DeleteKeyString(key string) error

func (ClusterAndRedisClient) DeleteKeysByDirectlyDelIt

func (client ClusterAndRedisClient) DeleteKeysByDirectlyDelIt(keyes []string) error

func (ClusterAndRedisClient) DeleteKeysByExpireIt

func (client ClusterAndRedisClient) DeleteKeysByExpireIt(keyes []string, expTime time.Duration) error

delete key by setting expire time of key to little seconds.

func (ClusterAndRedisClient) DeleteKeysByExpireItPipe

func (client ClusterAndRedisClient) DeleteKeysByExpireItPipe(keyes []string, expTime time.Duration) error

func (ClusterAndRedisClient) DeleteKeysByUnlinkIt

func (client ClusterAndRedisClient) DeleteKeysByUnlinkIt(keyes []string) error

func (ClusterAndRedisClient) GetClusterInfoAll

func (client ClusterAndRedisClient) GetClusterInfoAll() (ClusterInfoAll, error)

func (ClusterAndRedisClient) GetClusterInfoString

func (client ClusterAndRedisClient) GetClusterInfoString() (map[string]string, error)

func (ClusterAndRedisClient) GetElementCntPipe

func (client ClusterAndRedisClient) GetElementCntPipe(keys []string, keyType string) (map[string]int64, error)

func (ClusterAndRedisClient) GetHashValue

func (client ClusterAndRedisClient) GetHashValue(key string, eachCnt int64, elementBatch int,
	elementInterval time.Duration, ifSleep bool, ifBytes bool) (map[string]interface{},
	int, string, int, int, error)

func (ClusterAndRedisClient) GetKeyTTL

func (client ClusterAndRedisClient) GetKeyTTL(key string, timeFmt string) (string, error)

func (ClusterAndRedisClient) GetKeyType

func (client ClusterAndRedisClient) GetKeyType(key string) (string, error)

func (ClusterAndRedisClient) GetKeyValue

func (client ClusterAndRedisClient) GetKeyValue(key string, eachCnt int64, elementBatch int, elementInterval time.Duration, ifSleep bool,
	ifCountMem bool, ifNeedValue bool) (RedisKey, error)

get one key info and value

func (ClusterAndRedisClient) GetKeysTTLConditionPipe

func (client ClusterAndRedisClient) GetKeysTTLConditionPipe(keys []string, timeFmt string, minTtl, maxTtl int) (map[string]string, error)

func (ClusterAndRedisClient) GetKeysTTLPipe

func (client ClusterAndRedisClient) GetKeysTTLPipe(keys []string, timeFmt string) (map[string]string, error)

func (ClusterAndRedisClient) GetKeysTypePipe

func (client ClusterAndRedisClient) GetKeysTypePipe(keys []string) (map[string]string, error)

func (ClusterAndRedisClient) GetKeysValueAdaptive

func (client ClusterAndRedisClient) GetKeysValueAdaptive(keys []string, keyTp string, db uint, minBytes int64, tFormat string, minTtl int, maxTtl int,
	sampleRate uint, minSample uint, rangeBatch int64, elementBatch int64,
	elementInterval time.Duration, ifSleep, ifBytes, ifValue bool) ([]RedisKey, error)

func (ClusterAndRedisClient) GetLatestSlave

func (client ClusterAndRedisClient) GetLatestSlave(slaves []SlaveInfo) (SlaveInfo, error)

func (ClusterAndRedisClient) GetListLen

func (client ClusterAndRedisClient) GetListLen(key string) (int64, error)

func (ClusterAndRedisClient) GetListLenPipe

func (client ClusterAndRedisClient) GetListLenPipe(keys []string) (map[string]int64, error)

func (ClusterAndRedisClient) GetListValue

func (client ClusterAndRedisClient) GetListValue(key string, length int64, eachCnt int64, elementBatch int,
	elementInterval time.Duration, ifSleep bool, ifBytes bool) ([]string, int, string, int, error)

param: key name, key length, count of elements to get each time, sleep after this process elementBatch element, esleep time for elementInterval in microsecond, if sleep, if calculate memory used in bytes return: value, bytes of the key, biggest element, bytes of the biggest element, error

func (ClusterAndRedisClient) GetListValueSameKeyPipe

func (client ClusterAndRedisClient) GetListValueSameKeyPipe(key string, length int64, rangeBatch int64, elementBatch int64,
	elementInterval time.Duration, ifSleep, ifBytes, ifValue bool) (RedisValueList, error)

func (ClusterAndRedisClient) GetMemByMemUsagePipe

func (client ClusterAndRedisClient) GetMemByMemUsagePipe(keys map[string]int, minBytes int64) (map[string]int64, error)

func (ClusterAndRedisClient) GetMultiHashLenPipe

func (client ClusterAndRedisClient) GetMultiHashLenPipe(keys []string) (map[string]int64, error)

func (ClusterAndRedisClient) GetMultiHashValueAdaptive

func (client ClusterAndRedisClient) GetMultiHashValueAdaptive(keys []string, minBytes int64, rangeBatch int64, elementBatch int64,
	elementInterval time.Duration, ifSleep, ifBytes, ifValue bool) (map[string]RedisValueHash, error)

func (ClusterAndRedisClient) GetMultiHashValueByHgetallPipe

func (client ClusterAndRedisClient) GetMultiHashValueByHgetallPipe(keys []string, minBytes int64, ifBytes, ifValue bool) (map[string]RedisValueHash, error)

func (ClusterAndRedisClient) GetMultiKeyValuesByRangeAllPipe

func (client ClusterAndRedisClient) GetMultiKeyValuesByRangeAllPipe(keys []string, keyTp string, minBytes int64, ifBytes, ifValue bool) (map[string]RedisValueList, error)

func (ClusterAndRedisClient) GetMultiListValuesPipeAdaptive

func (client ClusterAndRedisClient) GetMultiListValuesPipeAdaptive(keys []string, minBytes int64, rangeBatch int64, elementBatch int64,
	elementInterval time.Duration, ifSleep, ifBytes, ifValue bool) (map[string]RedisValueList, error)

func (ClusterAndRedisClient) GetMultiSetCard

func (client ClusterAndRedisClient) GetMultiSetCard(keys []string) (map[string]int64, error)

func (ClusterAndRedisClient) GetMultiSetValueAdaptive

func (client ClusterAndRedisClient) GetMultiSetValueAdaptive(keys []string, minBytes int64, rangeBatch int64, elementBatch int64,
	elementInterval time.Duration, ifSleep, ifBytes, ifValue bool) (map[string]RedisValueList, error)

func (ClusterAndRedisClient) GetMultiSetValueBySmembersPipe

func (client ClusterAndRedisClient) GetMultiSetValueBySmembersPipe(keys []string, minBytes int64, ifBytes, ifValue bool) (map[string]RedisValueList, error)

func (ClusterAndRedisClient) GetMultiZsetValueByRangeAllPipeWithScore

func (client ClusterAndRedisClient) GetMultiZsetValueByRangeAllPipeWithScore(keys []string, minBytes int64, ifBytes, ifValue bool) (map[string]RedisValueZset, error)

func (ClusterAndRedisClient) GetMultiZsetValuesAdaptiveWithScore

func (client ClusterAndRedisClient) GetMultiZsetValuesAdaptiveWithScore(keys []string, minBytes int64, rangeBatch int64, elementBatch int64,
	elementInterval time.Duration, ifSleep, ifBytes, ifValue bool) (map[string]RedisValueZset, error)

func (ClusterAndRedisClient) GetMultiZsetValuesAdaptiveWithoutScore

func (client ClusterAndRedisClient) GetMultiZsetValuesAdaptiveWithoutScore(keys []string, minBytes int64, rangeBatch int64, elementBatch int64,
	elementInterval time.Duration, ifSleep, ifBytes, ifValue bool) (map[string]RedisValueList, error)

func (ClusterAndRedisClient) GetOneHashValueByScan

func (client ClusterAndRedisClient) GetOneHashValueByScan(key string, rangeBatch int64, elementBatch int64,
	elementInterval time.Duration, ifSleep, ifBytes, ifValue bool) (RedisValueHash, error)

func (ClusterAndRedisClient) GetOneSetValueByScan

func (client ClusterAndRedisClient) GetOneSetValueByScan(key string, rangeBatch int64, elementBatch int64,
	elementInterval time.Duration, ifSleep, ifBytes, ifValue bool) (RedisValueList, error)

func (ClusterAndRedisClient) GetOneValueByRangeSameKeyPipe

func (client ClusterAndRedisClient) GetOneValueByRangeSameKeyPipe(key string, keyTp string, length int64, rangeBatch int64, elementBatch int64,
	elementInterval time.Duration, ifSleep, ifBytes, ifValue bool) (RedisValueList, error)

func (ClusterAndRedisClient) GetOneZsetWithScoreSameKeyPipe

func (client ClusterAndRedisClient) GetOneZsetWithScoreSameKeyPipe(key string, length int64, rangeBatch int64, elementBatch int64,
	elementInterval time.Duration, ifSleep, ifBytes bool) (RedisValueZset, error)

func (ClusterAndRedisClient) GetPipeline

func (client ClusterAndRedisClient) GetPipeline() redis.Pipeliner

func (ClusterAndRedisClient) GetRedisConfVars

func (client ClusterAndRedisClient) GetRedisConfVars(ifErrBreak bool) (RedisConfVar, error)

func (ClusterAndRedisClient) GetRedisInfo

func (client ClusterAndRedisClient) GetRedisInfo(section string) (map[string]string, error)

func (ClusterAndRedisClient) GetRedisInfoAll

func (client ClusterAndRedisClient) GetRedisInfoAll(selfIps []string, port int, ifGetSlaveLag bool) (RedisInfoAll, error)

func (ClusterAndRedisClient) GetRedisInfoRole

func (client ClusterAndRedisClient) GetRedisInfoRole() (RedisRoleInfo, error)

func (ClusterAndRedisClient) GetRedisKeyArrBySample

func (client ClusterAndRedisClient) GetRedisKeyArrBySample(keys []string, keyLengths map[string]int64, ttls map[string]string, db uint, keyTp string,
	sampleRate uint, minSample uint, minBytes int64) ([]RedisKey, error)

func (ClusterAndRedisClient) GetRedisOneVarInt64

func (client ClusterAndRedisClient) GetRedisOneVarInt64(name string) (int64, error)

func (ClusterAndRedisClient) GetRedisOneVarString

func (client ClusterAndRedisClient) GetRedisOneVarString(name string) (string, error)

func (ClusterAndRedisClient) GetRedisOneVarUint64

func (client ClusterAndRedisClient) GetRedisOneVarUint64(name string) (uint64, error)

func (ClusterAndRedisClient) GetSetValue

func (client ClusterAndRedisClient) GetSetValue(key string, eachCnt int64, elementBatch int,
	elementInterval time.Duration, ifSleep bool, ifBytes bool) ([]string, int, string, int, int, error)

param: key name, count of elements to get each time, sleep after processing elementBatch elements,

sleep for elementInterval in microsecond, if calculate memory used in bytes

return: value, bytes of the key, biggest element, bytes of the biggest element, error

func (ClusterAndRedisClient) GetSlaveReplInfo

func (client ClusterAndRedisClient) GetSlaveReplInfo(infoStr string) (SlaveInfo, error)

func (ClusterAndRedisClient) GetSlavesReplicationStatus

func (client ClusterAndRedisClient) GetSlavesReplicationStatus(slaveIps map[string]int) (int64, int64, error)

func (ClusterAndRedisClient) GetStringValue

func (client ClusterAndRedisClient) GetStringValue(key string, ifBytes bool) (string, int, error)

func (ClusterAndRedisClient) GetStringValueMget

func (client ClusterAndRedisClient) GetStringValueMget(keys []string, minBytes int64, ifValue, ifBytes bool) (map[string]RedisValueString, error)

func (ClusterAndRedisClient) GetStringValuePipe

func (client ClusterAndRedisClient) GetStringValuePipe(keys []string, minBytes int64, ifValue, ifBytes bool) (map[string]RedisValueString, error)

func (ClusterAndRedisClient) GetZsetValue

func (client ClusterAndRedisClient) GetZsetValue(key string, eachCnt int64, elementBatch int,
	elementInterval time.Duration, ifSleep bool, ifBytes bool) (map[string]float64, int, string, int, int, error)

func (ClusterAndRedisClient) RedisPing

func (client ClusterAndRedisClient) RedisPing() bool

type ClusterAndRedisConf

type ClusterAndRedisConf struct {
	Redis     *redis.Options
	Cluster   *redis.ClusterOptions
	IsCluster bool
}

type ClusterInfoAll

type ClusterInfoAll struct {
	Cluster_state          int64 // OK: 1, 0: not ok
	Cluster_slots_assigned uint64
	Cluster_slots_ok       uint64
	Cluster_slots_pfail    uint64
	Cluster_slots_fail     uint64
}

type ClusterNodeInfo

type ClusterNodeInfo struct {
	NodeId      string
	Addr        string
	Flags       []string
	Role        string // master|slave
	PingSent    int
	PingRecv    int
	ConfEpoch   int
	LinkStatus  string //connected
	Slots       []int
	RehashSlots []SlotRehash
	MasterId    string
	MasterAddr  string
}

type ConfCluster

type ConfCluster struct {
	ConfCommon
	Addrs []string // host:port

	ReadOnly bool // if read slave

	MaxRedirects int
}

func (ConfCluster) CreateNewClientCluster

func (this ConfCluster) CreateNewClientCluster() (*redis.ClusterClient, error)

type ConfCommon

type ConfCommon struct {
	Password   string
	MaxRetries int

	DialTimeout  int
	ReadTimeout  int
	WriteTimeout int

	PoolSize           int
	PoolTimeout        int
	IdleTimeout        int
	IdleCheckFrequency int
}

type ConfRedis

type ConfRedis struct {
	ConfCommon
	//Network  string // tcp|unix
	Addr     string //host:port | socket
	Database int    // db number
	ReadOnly bool   // if read slave
}

func (ConfRedis) CreateNewClientRedis

func (this ConfRedis) CreateNewClientRedis() (*redis.Client, error)

type RedisAddr

type RedisAddr struct {
	Host string
	Port int
}

func ParseAddrFromFile

func ParseAddrFromFile(adrFile string) ([]RedisAddr, error)

func (RedisAddr) AddrString

func (this RedisAddr) AddrString() string

func (RedisAddr) CreateConPoolCluster

func (this RedisAddr) CreateConPoolCluster(readonly bool, poolSizeEachCpu int) (*redis.ClusterClient, error)

func (RedisAddr) CreateConPoolRedis

func (this RedisAddr) CreateConPoolRedis(db int, poolSizeEachCpu int) (*redis.Client, error)

func (RedisAddr) CreateRedisOrClusterConPool

func (this RedisAddr) CreateRedisOrClusterConPool(isCluster bool, readonly bool, db int, poolSizeEachCpu int) (ClusterAndRedisClient, error)

type RedisConfVar

type RedisConfVar struct {
	Maxmemory                     uint64
	Cluster_node_timeout          uint64
	Cluster_require_full_coverage int64 // yes: 1, no: 0
	Slave_serve_stale_data        int64 // yes:1, no:0
	Slave_read_only               int64 // yes:1, no:0
	Stop_writes_on_bgsave_error   int64 // yes:1, no:0
	Maxclients                    uint64
}

type RedisInfoAll

type RedisInfoAll struct {
	Redis_version              string
	IsCluster                  int64 // cluster:1, redis:0
	Process_id                 uint64
	Total_connections_received uint64
	Connected_clients          uint64
	Rejected_connections       uint64
	Blocked_clients            uint64
	Client_longest_output_list uint64
	Client_biggest_input_buf   uint64
	Total_commands_processed   uint64
	Instantaneous_ops_per_sec  float64
	Keyspace_hits              uint64
	Keyspace_misses            uint64
	Expired_keys               uint64
	Evicted_keys               uint64
	Keys_alldb                 uint64 // number of keys of all db
	Keys_expires               uint64 // number of keys with expiration of all db
	Total_net_input_bytes      uint64
	Total_net_output_bytes     uint64
	Instantaneous_input_kbps   float64
	Instantaneous_output_kbps  float64
	Used_memory                uint64
	Used_memory_rss            uint64
	Used_memory_peak           uint64
	Used_memory_lua            uint64
	Mem_fragmentation_ratio    float64
	LoadingRdb                 int64
	Rdb_bgsave_in_progress     int64
	Rdb_last_bgsave_status     int64 // ok: 0, error: 1
	Aof_rewrite_in_progress    int64
	Aof_last_bgrewrite_status  int64 // ok: 0, error: 1
	Aof_last_write_status      int64 // ok: 0, error: 1
	Pubsub_channels            uint64
	Pubsub_patterns            uint64
	Role                       string
	Connected_slaves           uint64
	Master_host                string
	Master_port                uint64
	Master_link_status         int64 // up: 1, else: 0
	SlaveLag                   int64
	Master_sync_in_progress    int64
}

type RedisKey

type RedisKey struct {
	Database        uint
	Bytes           int64 // bytes of key and value
	ElementCnt      int64 // for list|set|hash|zset, the count of the elements
	Type            string
	Expire          string
	MaxElementBytes int64  // bytes of max element of key
	Key             string // key
	MaxElement      string // max element of key
	Value           interface{}
}

func (RedisKey) DumpJsonStr

func (this RedisKey) DumpJsonStr(ifPretty bool, indent string) (string, error)

func (RedisKey) GetRedisKeyPrintLine

func (this RedisKey) GetRedisKeyPrintLine(ifBigkey bool, ifPretty bool, indent string) (string, error)

func (RedisKey) ToStringWithoutValue

func (this RedisKey) ToStringWithoutValue() string

type RedisReplStatus

type RedisReplStatus struct {
	SlaveAddr RedisAddr
	IfOnline  bool
	Offset    int64
	Lag       int64
}

type RedisRoleInfo

type RedisRoleInfo struct {
	Role        string // master or slave
	MasterAddr  RedisAddr
	Replicating bool        // for slave, master_link_status:up
	Slaves      []SlaveInfo // for master
}

type RedisServer

type RedisServer struct {
	IsCluster  bool
	Addr       RedisAddr
	Role       uint8 // 0:master, 1:slave, 2:master and slave
	Version    string
	Master     RedisAddr
	Slaves     map[string]*RedisReplStatus
	ReplStatus *RedisReplStatus
}

func (*RedisServer) CreateGenClientPool

func (this *RedisServer) CreateGenClientPool(readonly bool, db int, poolSizeEachCpu int) (ClusterAndRedisClient, error)

func (*RedisServer) GetAllNodesAddrStr

func (this *RedisServer) GetAllNodesAddrStr() []string

func (*RedisServer) GetAndSetRedisInfo

func (this *RedisServer) GetAndSetRedisInfo() error

func (*RedisServer) GetLatestSlave

func (this *RedisServer) GetLatestSlave() (RedisAddr, error)

func (*RedisServer) GetMasterAddrStr

func (this *RedisServer) GetMasterAddrStr() string

func (*RedisServer) GetSlavesAddrStr

func (this *RedisServer) GetSlavesAddrStr() []string

func (*RedisServer) InfoString

func (this *RedisServer) InfoString() string

func (*RedisServer) IsMaster

func (this *RedisServer) IsMaster() bool

func (*RedisServer) IsMasterAndSlave

func (this *RedisServer) IsMasterAndSlave() bool

func (*RedisServer) IsSlave

func (this *RedisServer) IsSlave() bool

type RedisValueHash

type RedisValueHash struct {
	Value           map[string]string
	ElementCnt      int64
	BytesCnt        int64
	BiggestElement  string
	BiggestBytesCnt int64
}

type RedisValueList

type RedisValueList struct {
	Value           []string
	ElementCnt      int64
	BytesCnt        int64
	BiggestElement  string
	BiggestBytesCnt int64
}

type RedisValueString

type RedisValueString struct {
	Value    string
	BytesCnt int64
}

type RedisValueZset

type RedisValueZset struct {
	Value           map[string]float64
	ElementCnt      int64
	BytesCnt        int64
	BiggestElement  string
	BiggestBytesCnt int64
}

type SlaveInfo

type SlaveInfo struct {
	Addr        RedisAddr
	Replicating bool // state=online
	Lag         int
	Offset      int
}

type SlotRehash

type SlotRehash struct {
	Slot      int
	SrcId     string
	SrcAddr   string
	DestId    string
	DestAddr  string
	IsMigrate bool // true: migrate, false: importing

}

func SlotsStrToSeperateInts

func SlotsStrToSeperateInts(slts []string) ([]int, []SlotRehash)

Jump to

Keyboard shortcuts

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