Documentation
¶
Index ¶
- func BatchCallCmd(nodes []*util.PegasusNode, cmd string, args []string) map[*util.PegasusNode]*CmdResult
- func DowngradeNode(meta Meta, node *util.PegasusNode) error
- func MigratePrimariesOut(meta Meta, node *util.PegasusNode) error
- func SetMetaLevelLively(meta Meta) error
- func SetMetaLevelSteady(meta Meta) error
- func SetRPCTimeout(d time.Duration)
- type BalanceType
- type ClusterReplicaInfo
- type CmdResult
- type Meta
- type NodeState
- type TableHealthInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BatchCallCmd ¶ added in v1.0.3
func BatchCallCmd(nodes []*util.PegasusNode, cmd string, args []string) map[*util.PegasusNode]*CmdResult
BatchCallCmd performs remote commands in parallel to multiple nodes.
func DowngradeNode ¶ added in v1.0.2
func DowngradeNode(meta Meta, node *util.PegasusNode) error
DowngradeNode sets all secondaries from the specified node to inactive state. NOTE: this step requires that the node has no primary, otherwise error is returned.
func MigratePrimariesOut ¶ added in v1.0.2
func MigratePrimariesOut(meta Meta, node *util.PegasusNode) error
MigratePrimariesOut migrates all primaries out from the specified node. Internally, for every partition it merely swaps the roles of primary and secondary, so it incurs no data migration. Eventually, the node will have no primaries because they are all turned to secondaries.
func SetMetaLevelLively ¶ added in v1.0.2
func SetMetaLevelSteady ¶ added in v1.0.2
func SetRPCTimeout ¶
SetRPCTimeout is the global timeout setting of RPC.
Types ¶
type BalanceType ¶ added in v1.0.2
type BalanceType int
const ( BalanceMovePri BalanceType = iota BalanceCopyPri BalanceCopySec )
func (BalanceType) String ¶ added in v1.0.2
func (t BalanceType) String() string
type ClusterReplicaInfo ¶ added in v1.0.3
type ClusterReplicaInfo struct {
Tables []*TableHealthInfo
Nodes []*NodeState
}
ClusterReplicaInfo is a report of the replicas distributed in the cluster.
func GetClusterReplicaInfo ¶ added in v1.0.3
func GetClusterReplicaInfo(meta Meta) (*ClusterReplicaInfo, error)
GetClusterReplicaInfo returns replica info in both node and table perspectives. = From node perspective, it returns a list of node states, each contains the replica details, including those with no replicas (empty node). = From table perspective, it returns a list of table states, each contains the partition health information.
type CmdResult ¶ added in v1.0.3
type CmdResult struct {
// contains filtered or unexported fields
}
CmdResult is the result of remote command to a node.
type Meta ¶
type Meta interface {
Close() error
// ListAvailableApps lists only available tables.
ListAvailableApps() ([]*admin.AppInfo, error)
ListApps(status admin.AppStatus) ([]*admin.AppInfo, error)
QueryConfig(tableName string) (*replication.QueryCfgResponse, error)
MetaControl(level admin.MetaFunctionLevel) (oldLevel admin.MetaFunctionLevel, err error)
QueryClusterInfo() (map[string]string, error)
UpdateAppEnvs(tableName string, envs map[string]string) error
ClearAppEnvs(tableName string, clearPrefix string) error
DelAppEnvs(tableName string, keys []string) error
CreateApp(tableName string, envs map[string]string, partitionCount int) (int32, error)
DropApp(tableName string, reserveSeconds int64) error
ModifyDuplication(tableName string, dupid int, status admin.DuplicationStatus) error
AddDuplication(tableName string, remoteCluster string, freezed bool) (*admin.DuplicationAddResponse, error)
QueryDuplication(tableName string) (*admin.DuplicationQueryResponse, error)
ListNodes() ([]*admin.NodeInfo, error)
RecallApp(originTableID int, newTableName string) (*admin.AppInfo, error)
Balance(gpid *base.Gpid, opType BalanceType, from *util.PegasusNode, to *util.PegasusNode) error
Propose(gpid *base.Gpid, action admin.ConfigType, target *util.PegasusNode, node *util.PegasusNode) error
}
Meta is a helper over pegasus-go-client's primitive session.MetaManager. It aims to provide an easy-to-use API that eliminates some boilerplate code, like context creation, request/response creation, etc.
func NewRPCBasedMeta ¶
NewRPCBasedMeta creates the connection to meta.
type NodeState ¶ added in v1.0.3
type NodeState struct {
IPPort string
Status admin.NodeStatus
PrimariesNum int
SecondariesNum int
ReplicaCount int
}
func ListNodesReplicaInfo ¶ added in v1.0.3
ListNodesReplicaInfo returns how replicas distributed among nodes.
type TableHealthInfo ¶ added in v1.0.2
type TableHealthInfo struct {
PartitionCount int32
Unhealthy int32
WriteUnhealthy int32
ReadUnhealthy int32
FullHealthy int32
}
TableHealthInfo is a report of replica health within the table.
func GetTableHealthInfo ¶ added in v1.0.2
func GetTableHealthInfo(meta Meta, tableName string) (*TableHealthInfo, error)
GetTableHealthInfo return *TableHealthInfo from meta.