Documentation
¶
Index ¶
- Constants
- Variables
- func CompareRedisVersionInt(a, b []uint8) (int, error)
- func CompareRedisVersionStr(a, b string) (int, error)
- func GetAllMastersAddr(sarr map[string]*ClusterNodeInfo) []string
- func GetAllSlavesAddr(sarr map[string]*ClusterNodeInfo) []string
- func GetClusterNodesAddr(client *redis.ClusterClient) (map[string]RedisAddr, error)
- func GetClusterNodesInfo(client *redis.ClusterClient) (map[string]*ClusterNodeInfo, error)
- func GetInfoStringForNodes(prefixMsg string, nodes map[string]*RedisServer, ...) string
- func GetInfoStringOnlyOneNode(node *RedisServer, masters map[string]*RedisServer) string
- func GetInfoStringOnlyOneSlaveAndMaster(ifSlaveFirst bool, slave, master *RedisServer) string
- func GetLatestSlaveOfMasters(masters []string) (map[string]string, []string, []string, error)
- func GetMemUseSampleNotString(keys map[string]int64, sampleRate int64, minNumb int64) map[string]int
- func GetRedisAddr(host string, port int) string
- func GetRedisBigkeyHeader() string
- func GetStringKeySample(keys []string) map[string]int
- func ParseDBkeyspce(line string) (uint64, uint64, float64, error)
- func ParseInfoClient(result map[string]string, info *RedisInfoAll)
- func ParseInfoKeyspace(result map[string]string, info *RedisInfoAll)
- func ParseInfoMemory(result map[string]string, info *RedisInfoAll)
- func ParseInfoPersistent(result map[string]string, info *RedisInfoAll)
- func ParseInfoReplication(result map[string]string, info *RedisInfoAll)
- func ParseInfoSever(result map[string]string, info *RedisInfoAll)
- func ParseInfoStats(result map[string]string, info *RedisInfoAll)
- func ParseMasterReplStatus(sts map[string]string) map[string]*RedisReplStatus
- func ParseRedisVersion(version string) ([]uint8, error)
- func ProcessArrayOfStringSliceCmdResultSameKey(cmdArr []*redis.StringSliceCmd, result *RedisValueList, ifBytes, ifValue bool) error
- func ProcessOneStringSliceCmdResult(cmd *redis.StringSliceCmd, result *RedisValueList, ifBytes, ifValue bool) error
- func ProcessOneZsliceResult(cmd *redis.ZSliceCmd, result *RedisValueZset, ifBytes, ifValue bool) error
- func ProcessZsliceResultArrayButSameKey(cmdArr []*redis.ZSliceCmd, result *RedisValueZset, ifBytes, ifValue bool) error
- func ScanRedisKeys(client *redis.Client, scanCnt int64, matchRe *regexp.Regexp, sleepCnt int, ...) error
- type ClusterAndRedisClient
- func (client ClusterAndRedisClient) CheckIfCluster() (bool, error)
- func (client ClusterAndRedisClient) Close()
- func (client ClusterAndRedisClient) DeleteKeyList(key string, length int64, eachCnt int64, elementBatch int64, ...) error
- func (client ClusterAndRedisClient) DeleteKeyString(key string) error
- func (client ClusterAndRedisClient) DeleteKeysByDirectlyDelIt(keyes []string) error
- func (client ClusterAndRedisClient) DeleteKeysByExpireIt(keyes []string, expTime time.Duration) error
- func (client ClusterAndRedisClient) DeleteKeysByExpireItPipe(keyes []string, expTime time.Duration) error
- func (client ClusterAndRedisClient) DeleteKeysByUnlinkIt(keyes []string) error
- func (client ClusterAndRedisClient) GetClusterInfoAll() (ClusterInfoAll, error)
- func (client ClusterAndRedisClient) GetClusterInfoString() (map[string]string, error)
- func (client ClusterAndRedisClient) GetElementCntPipe(keys []string, keyType string) (map[string]int64, error)
- func (client ClusterAndRedisClient) GetHashValue(key string, eachCnt int64, elementBatch int, elementInterval time.Duration, ...) (map[string]interface{}, int, string, int, int, error)
- func (client ClusterAndRedisClient) GetKeyTTL(key string, timeFmt string) (string, error)
- func (client ClusterAndRedisClient) GetKeyType(key string) (string, error)
- func (client ClusterAndRedisClient) GetKeyValue(key string, eachCnt int64, elementBatch int, elementInterval time.Duration, ...) (RedisKey, error)
- func (client ClusterAndRedisClient) GetKeysTTLConditionPipe(keys []string, timeFmt string, minTtl, maxTtl int) (map[string]string, error)
- func (client ClusterAndRedisClient) GetKeysTTLPipe(keys []string, timeFmt string) (map[string]string, error)
- func (client ClusterAndRedisClient) GetKeysTypePipe(keys []string) (map[string]string, error)
- func (client ClusterAndRedisClient) GetKeysValueAdaptive(keys []string, keyTp string, db uint, minBytes int64, tFormat string, ...) ([]RedisKey, error)
- func (client ClusterAndRedisClient) GetLatestSlave(slaves []SlaveInfo) (SlaveInfo, error)
- func (client ClusterAndRedisClient) GetListLen(key string) (int64, error)
- func (client ClusterAndRedisClient) GetListLenPipe(keys []string) (map[string]int64, error)
- func (client ClusterAndRedisClient) GetListValue(key string, length int64, eachCnt int64, elementBatch int, ...) ([]string, int, string, int, error)
- func (client ClusterAndRedisClient) GetListValueSameKeyPipe(key string, length int64, rangeBatch int64, elementBatch int64, ...) (RedisValueList, error)
- func (client ClusterAndRedisClient) GetMemByMemUsagePipe(keys map[string]int, minBytes int64) (map[string]int64, error)
- func (client ClusterAndRedisClient) GetMultiHashLenPipe(keys []string) (map[string]int64, error)
- func (client ClusterAndRedisClient) GetMultiHashValueAdaptive(keys []string, minBytes int64, rangeBatch int64, elementBatch int64, ...) (map[string]RedisValueHash, error)
- func (client ClusterAndRedisClient) GetMultiHashValueByHgetallPipe(keys []string, minBytes int64, ifBytes, ifValue bool) (map[string]RedisValueHash, error)
- func (client ClusterAndRedisClient) GetMultiKeyValuesByRangeAllPipe(keys []string, keyTp string, minBytes int64, ifBytes, ifValue bool) (map[string]RedisValueList, error)
- func (client ClusterAndRedisClient) GetMultiListValuesPipeAdaptive(keys []string, minBytes int64, rangeBatch int64, elementBatch int64, ...) (map[string]RedisValueList, error)
- func (client ClusterAndRedisClient) GetMultiSetCard(keys []string) (map[string]int64, error)
- func (client ClusterAndRedisClient) GetMultiSetValueAdaptive(keys []string, minBytes int64, rangeBatch int64, elementBatch int64, ...) (map[string]RedisValueList, error)
- func (client ClusterAndRedisClient) GetMultiSetValueBySmembersPipe(keys []string, minBytes int64, ifBytes, ifValue bool) (map[string]RedisValueList, error)
- func (client ClusterAndRedisClient) GetMultiZsetValueByRangeAllPipeWithScore(keys []string, minBytes int64, ifBytes, ifValue bool) (map[string]RedisValueZset, error)
- func (client ClusterAndRedisClient) GetMultiZsetValuesAdaptiveWithScore(keys []string, minBytes int64, rangeBatch int64, elementBatch int64, ...) (map[string]RedisValueZset, error)
- func (client ClusterAndRedisClient) GetMultiZsetValuesAdaptiveWithoutScore(keys []string, minBytes int64, rangeBatch int64, elementBatch int64, ...) (map[string]RedisValueList, error)
- func (client ClusterAndRedisClient) GetOneHashValueByScan(key string, rangeBatch int64, elementBatch int64, ...) (RedisValueHash, error)
- func (client ClusterAndRedisClient) GetOneSetValueByScan(key string, rangeBatch int64, elementBatch int64, ...) (RedisValueList, error)
- func (client ClusterAndRedisClient) GetOneValueByRangeSameKeyPipe(key string, keyTp string, length int64, rangeBatch int64, elementBatch int64, ...) (RedisValueList, error)
- func (client ClusterAndRedisClient) GetOneZsetWithScoreSameKeyPipe(key string, length int64, rangeBatch int64, elementBatch int64, ...) (RedisValueZset, error)
- func (client ClusterAndRedisClient) GetPipeline() redis.Pipeliner
- func (client ClusterAndRedisClient) GetRedisConfVars(ifErrBreak bool) (RedisConfVar, error)
- func (client ClusterAndRedisClient) GetRedisInfo(section string) (map[string]string, error)
- func (client ClusterAndRedisClient) GetRedisInfoAll(selfIps []string, port int, ifGetSlaveLag bool) (RedisInfoAll, error)
- func (client ClusterAndRedisClient) GetRedisInfoRole() (RedisRoleInfo, error)
- func (client ClusterAndRedisClient) GetRedisKeyArrBySample(keys []string, keyLengths map[string]int64, ttls map[string]string, db uint, ...) ([]RedisKey, error)
- func (client ClusterAndRedisClient) GetRedisOneVarInt64(name string) (int64, error)
- func (client ClusterAndRedisClient) GetRedisOneVarString(name string) (string, error)
- func (client ClusterAndRedisClient) GetRedisOneVarUint64(name string) (uint64, error)
- func (client ClusterAndRedisClient) GetSetValue(key string, eachCnt int64, elementBatch int, elementInterval time.Duration, ...) ([]string, int, string, int, int, error)
- func (client ClusterAndRedisClient) GetSlaveReplInfo(infoStr string) (SlaveInfo, error)
- func (client ClusterAndRedisClient) GetSlavesReplicationStatus(slaveIps map[string]int) (int64, int64, error)
- func (client ClusterAndRedisClient) GetStringValue(key string, ifBytes bool) (string, int, error)
- func (client ClusterAndRedisClient) GetStringValueMget(keys []string, minBytes int64, ifValue, ifBytes bool) (map[string]RedisValueString, error)
- func (client ClusterAndRedisClient) GetStringValuePipe(keys []string, minBytes int64, ifValue, ifBytes bool) (map[string]RedisValueString, error)
- func (client ClusterAndRedisClient) GetZsetValue(key string, eachCnt int64, elementBatch int, elementInterval time.Duration, ...) (map[string]float64, int, string, int, int, error)
- func (client ClusterAndRedisClient) RedisPing() bool
- type ClusterAndRedisConf
- type ClusterInfoAll
- type ClusterNodeInfo
- type ConfCluster
- type ConfCommon
- type ConfRedis
- type RedisAddr
- func (this RedisAddr) AddrString() string
- func (this RedisAddr) CreateConPoolCluster(readonly bool, poolSizeEachCpu int) (*redis.ClusterClient, error)
- func (this RedisAddr) CreateConPoolRedis(db int, poolSizeEachCpu int) (*redis.Client, error)
- func (this RedisAddr) CreateRedisOrClusterConPool(isCluster bool, readonly bool, db int, poolSizeEachCpu int) (ClusterAndRedisClient, error)
- type RedisConfVar
- type RedisInfoAll
- type RedisKey
- type RedisReplStatus
- type RedisRoleInfo
- type RedisServer
- func (this *RedisServer) CreateGenClientPool(readonly bool, db int, poolSizeEachCpu int) (ClusterAndRedisClient, error)
- func (this *RedisServer) GetAllNodesAddrStr() []string
- func (this *RedisServer) GetAndSetRedisInfo() error
- func (this *RedisServer) GetLatestSlave() (RedisAddr, error)
- func (this *RedisServer) GetMasterAddrStr() string
- func (this *RedisServer) GetSlavesAddrStr() []string
- func (this *RedisServer) InfoString() string
- func (this *RedisServer) IsMaster() bool
- func (this *RedisServer) IsMasterAndSlave() bool
- func (this *RedisServer) IsSlave() bool
- type RedisValueHash
- type RedisValueList
- type RedisValueString
- type RedisValueZset
- type SlaveInfo
- type SlotRehash
Constants ¶
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" )
const ( CRoleMaster uint8 = 0 CRoleSlave uint8 = 1 CRoleMasterSlave uint8 = 2 )
Variables ¶
var ( G_regexp_info_keyspace_db *regexp.Regexp = regexp.MustCompile(`db\d+`) G_regexp_info_replication_slave *regexp.Regexp = regexp.MustCompile(`slave\d+`) )
var (
G_Redis_BigKey_Headers []string = []string{"db", "sizeInByte", "elementCnt", "type", "expire", "bigSize", "key", "big"}
)
Functions ¶
func CompareRedisVersionInt ¶
func CompareRedisVersionStr ¶
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 GetMemUseSampleNotString ¶
func GetMemUseSampleNotString(keys map[string]int64, sampleRate int64, minNumb int64) map[string]int
keys: keyname=>elementCnt
func GetRedisAddr ¶
func GetRedisBigkeyHeader ¶
func GetRedisBigkeyHeader() string
func GetStringKeySample ¶
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 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
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 (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 (ClusterAndRedisClient) GetHashValue ¶
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 (ClusterAndRedisClient) GetKeysTTLPipe ¶
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 (ClusterAndRedisClient) GetMultiHashLenPipe ¶
func (client ClusterAndRedisClient) GetMultiHashLenPipe(keys []string) (map[string]int64, error)
func (ClusterAndRedisClient) GetMultiHashValueAdaptive ¶
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 (ClusterAndRedisClient) GetMultiSetCard ¶
func (client ClusterAndRedisClient) GetMultiSetCard(keys []string) (map[string]int64, error)
func (ClusterAndRedisClient) GetMultiSetValueAdaptive ¶
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 (ClusterAndRedisClient) GetMultiZsetValuesAdaptiveWithoutScore ¶
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 (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 (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 (ClusterAndRedisClient) GetStringValue ¶
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 (ClusterAndRedisClient) RedisPing ¶
func (client ClusterAndRedisClient) RedisPing() bool
type ClusterAndRedisConf ¶
type ClusterAndRedisConf struct { Redis *redis.Options Cluster *redis.ClusterOptions IsCluster bool }
type ClusterInfoAll ¶
type ClusterNodeInfo ¶
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 ConfRedis ¶
type ConfRedis struct { ConfCommon //Network string // tcp|unix Addr string //host:port | socket Database int // db number ReadOnly bool // if read slave }
type RedisAddr ¶
func ParseAddrFromFile ¶
func (RedisAddr) AddrString ¶
func (RedisAddr) CreateConPoolCluster ¶
func (RedisAddr) CreateConPoolRedis ¶
func (RedisAddr) CreateRedisOrClusterConPool ¶
type RedisConfVar ¶
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 (RedisKey) GetRedisKeyPrintLine ¶
func (RedisKey) ToStringWithoutValue ¶
type RedisReplStatus ¶
type RedisRoleInfo ¶
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 RedisValueList ¶
type RedisValueString ¶
type RedisValueZset ¶
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)