Documentation ¶
Index ¶
- Variables
- func IsError(message string) bool
- func IsFailoverNotOnReplica(err error) bool
- func IsGenericError(err error) bool
- func IsLoading(err error) bool
- func IsNodeIsNotMaster(err error) bool
- func Pprint(str interface{}) string
- func SortACLFields(acl *RedisACL)
- type ByName
- type RedisACL
- type RedisACLChannels
- type RedisACLCommands
- type RedisACLKeys
- type RedisACLPasswords
- type RedisACLUser
- type RedisAuth
- type RedisCLI
- func (r *RedisCLI) ACLList(nodeIP string) (*RedisACL, error)
- func (r *RedisCLI) ACLLoad(nodeIP string) (string, error)
- func (r *RedisCLI) AddFollower(newNodeIP string, nodeIP string, leaderID string) (string, error)
- func (r *RedisCLI) ClusterCheck(nodeIP string) (string, error)
- func (r *RedisCLI) ClusterCreate(leaderIPs []string) (string, error)
- func (r *RedisCLI) ClusterFailover(nodeIP string, opt ...string) (string, error)
- func (r *RedisCLI) ClusterForget(nodeIP string, forgetNodeID string) (string, error)
- func (r *RedisCLI) ClusterInfo(nodeIP string) (*RedisClusterInfo, error)
- func (r *RedisCLI) ClusterMeet(nodeIP string, newNodeIP string, newNodePort string, newNodeBusPort ...string) (string, error)
- func (r *RedisCLI) ClusterNodes(nodeIP string) (*RedisClusterNodes, error)
- func (r *RedisCLI) ClusterReplicas(nodeIP string, leaderNodeID string) (*RedisClusterNodes, error)
- func (r *RedisCLI) ClusterReplicate(nodeIP string, leaderID string) (string, error)
- func (r *RedisCLI) ClusterReset(nodeIP string, opt ...string) (string, error)
- func (r *RedisCLI) DelNode(nodeIP string, nodeID string) (string, error)
- func (r *RedisCLI) Flushall(nodeIP string, opt ...string) (string, error)
- func (r *RedisCLI) Info(nodeIP string) (*RedisInfo, error)
- func (r *RedisCLI) MyClusterID(nodeIP string) (string, error)
- func (r *RedisCLI) Ping(nodeIP string, message ...string) (string, error)
- type RedisClusterInfo
- type RedisClusterNode
- type RedisClusterNodes
- type RedisInfo
Constants ¶
This section is empty.
Variables ¶
var ERR_STRINGS = map[string]string{
"idnotdef": "No such node ID",
"nodenotmaster": "The specified node is not a master",
"unknown": "Unknown node",
"failoverreplica": "ERR You should send CLUSTER FAILOVER to a replica",
}
var SHARED_ERR_STRINGS = map[string]string{
"wrongtype": "WRONGTYPE Operation against a key holding the wrong kind of value",
"nokeyerr": "ERR no such key",
"syntaxerr": "ERR syntax error",
"srcdsterr": "ERR source and destination objects are the same",
"indexrangeerr": "ERR index out of range",
"noscript": "NOSCRIPT No matching script. Please use EVAL",
"loading": "LOADING Redis is loading the dataset in memory",
"busy": "BUSY Redis is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE",
"masterdown": "MASTERDOWN Link with MASTER is down and replica-serve-stale-data is set to 'no'",
"misconf": "MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk",
"readonly": "READONLY You can't write against a read only replica",
"noauth": "NOAUTH Authentication required",
"oom": "OOM command not allowed when used memory > 'maxmemory'",
"execabort": "EXECABORT Transaction discarded because of previous errors",
"noreplicas": "NOREPLICAS Not enough good replicas to write",
"busykey": "BUSYKEY Target key name already exists",
}
https://github.com/redis/redis/blob/899c85ae67631f4f9f866a254ac5e149b86e5529/src/server.c#L2493
Functions ¶
func IsFailoverNotOnReplica ¶
func IsGenericError ¶
Checks if an error is prefixed by the generic ERR string
func IsNodeIsNotMaster ¶
func SortACLFields ¶
func SortACLFields(acl *RedisACL)
Types ¶
type ByName ¶
type ByName []RedisACLUser
type RedisACLChannels ¶
func (*RedisACLChannels) String ¶
func (t *RedisACLChannels) String() string
type RedisACLCommands ¶
type RedisACLCommands struct { Commands []string RmCommands []string AllCommands bool NoCommands bool }
Important: the struct will not preserve the order of remove and add operations, please group all removes and adds together
func (*RedisACLCommands) String ¶
func (t *RedisACLCommands) String() string
type RedisACLKeys ¶
func (*RedisACLKeys) String ¶
func (t *RedisACLKeys) String() string
type RedisACLPasswords ¶
type RedisACLPasswords struct { Passwords []string RmPasswords []string Hashes []string RmHashes []string NoPass bool ResetPass bool }
func (*RedisACLPasswords) String ¶
func (t *RedisACLPasswords) String() string
type RedisACLUser ¶
type RedisACLUser struct { Name string On bool Reset bool Commands RedisACLCommands Keys RedisACLKeys Channels RedisACLChannels Passwords RedisACLPasswords }
type RedisCLI ¶
func NewRedisCLI ¶
func (*RedisCLI) AddFollower ¶
AddFollower uses the '--cluster add-node' option on redis-cli to add a node to the cluster newNodeIP: IP of the follower that will join the cluster nodeIP: IP of a node in the cluster leaderID: Redis ID of the leader that the new follower will replicate
func (*RedisCLI) ClusterCreate ¶
ClusterCreate uses the '--cluster create' option on redis-cli to create a cluster using a list of nodes
func (*RedisCLI) ClusterFailover ¶
func (*RedisCLI) ClusterForget ¶
ForgetNode command is used in order to remove a node, specified via its node ID, from the set of known nodes of the Redis Cluster node receiving the command. In other words the specified node is removed from the nodes table of the node receiving the command. https://redis.io/commands/cluster-forget
func (*RedisCLI) ClusterInfo ¶
func (r *RedisCLI) ClusterInfo(nodeIP string) (*RedisClusterInfo, error)
func (*RedisCLI) ClusterMeet ¶
func (*RedisCLI) ClusterNodes ¶
func (r *RedisCLI) ClusterNodes(nodeIP string) (*RedisClusterNodes, error)
func (*RedisCLI) ClusterReplicas ¶
func (r *RedisCLI) ClusterReplicas(nodeIP string, leaderNodeID string) (*RedisClusterNodes, error)
ClusterReplicas command provides a list of replica nodes replicating from a specified leader node https://redis.io/commands/cluster-replicas
func (*RedisCLI) ClusterReplicate ¶
func (*RedisCLI) ClusterReset ¶
func (*RedisCLI) DelNode ¶
DelNode uses the '--cluster del-node' option of redis-cli to remove a node from the cluster nodeIP: any node of the cluster nodeID: node that needs to be removed
func (*RedisCLI) MyClusterID ¶
type RedisClusterInfo ¶
https://redis.io/commands/cluster-info
func NewRedisClusterInfo ¶
func NewRedisClusterInfo(rawData string) *RedisClusterInfo
func (*RedisClusterInfo) IsClusterFail ¶
func (r *RedisClusterInfo) IsClusterFail() bool
type RedisClusterNode ¶
type RedisClusterNode struct { ID string Addr string Flags string Leader string PingSend string PingRecv string ConfigEpoch string LinkState string }
func (*RedisClusterNode) IsFailing ¶
func (r *RedisClusterNode) IsFailing() bool
IsFailing method return true when the current redis node is in failing state and needs to be forgotten by the cluster
type RedisClusterNodes ¶
type RedisClusterNodes []RedisClusterNode
RedisClusterNodes command: https://redis.io/commands/cluster-nodes
func NewRedisClusterNodes ¶
func NewRedisClusterNodes(rawData string) *RedisClusterNodes
NewRedisClusterNodes is a constructor for RedisClusterNodes
func (*RedisClusterNodes) GetIDForIP ¶
func (r *RedisClusterNodes) GetIDForIP(ip string) string
Returns the Redis node ID for a specified IP or empty string if IP not found Supports the IP and IP:port format
func (*RedisClusterNodes) GetIPForID ¶
func (r *RedisClusterNodes) GetIPForID(id string) (string, string)
Returns the IP and port for a given Redis ID or empty strings if ID not found
type RedisInfo ¶
type RedisInfo struct { Server map[string]string Clients map[string]string Memory map[string]string Persistence map[string]string Stats map[string]string Replication map[string]string CPU map[string]string Cluster map[string]string Modules map[string]string Keyspace map[string]string }
https://redis.io/commands/info
func NewRedisInfo ¶
func (*RedisInfo) GetLoadETA ¶
GetLoadETA indicating if the load of a dump file is on-going If a load operation is on-going, it returns the ETA to finish.
func (*RedisInfo) GetSyncStatus ¶
Returns the estimated completion percentage or the empty string if SYNC is not in progress