model

package
Version: v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2020 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RPCBackupStatus   = "BackupRPC.GetBackupStatus"
	RPCBackupDo       = "BackupRPC.DoBackup"
	RPCBackupCancel   = "BackupRPC.CancelBackup"
	RPCBackupApplyLog = "BackupRPC.DoApplyLog"
)
View Source
const (
	OK                    = "OK"
	ErrorRPCCall          = "ErrorRpcCall"
	ErrorMySQLDown        = "ErrorMySQLDown"
	ErrorServerDown       = "ErrorServerDown"
	ErrorInvalidGTID      = "ErrorInvalidGTID"
	ErrorInvalidViewID    = "ErrorInvalidViewID"
	ErrorVoteNotGranted   = "ErrorVoteNotGranted"
	ErrorInvalidRequest   = "ErrorInvalidRequest"
	ErrorChangeMaster     = "ErrorChangeMaster"
	ErrorBackupNotFound   = "ErrorBackupNotFound"
	ErrorMysqldNotRunning = "ErrorMysqldNotRunning"
)
View Source
const (
	RPCHASetLearner  = "HARPC.HASetLearner"
	RPCHADisable     = "HARPC.HADisable"
	RPCHAEnable      = "HARPC.HAEnable"
	RPCHATryToLeader = "HARPC.HATryToLeader"
)
View Source
const (
	RPCMysqlStatus                   = "MysqlRPC.Status"
	RPCMysqlGTIDSubtract             = "MysqlRPC.GTIDSubtract"
	RPCMysqlSetState                 = "MysqlRPC.SetState"
	RPCMysqlSetGlobalSysVar          = "MysqlRPC.SetGlobalSysVar"
	RPCMysqlCreateUserWithPrivileges = "UserRPC.CreateUserWithPrivileges"
	RPCMysqlCreateNormalUser         = "UserRPC.CreateNormalUser"
	RPCMysqlCreateSuperUser          = "UserRPC.CreateSuperUser"
	RPCMysqlChangePassword           = "UserRPC.ChangePasword"
	RPCMysqlDropUser                 = "UserRPC.DropUser"
	RPCMysqlGetUser                  = "UserRPC.GetUser"
	RPCMysqlStartSlave               = "MysqlRPC.StartSlave"
	RPCMysqlStopSlave                = "MysqlRPC.StopSlave"
	RPCMysqlResetMaster              = "MysqlRPC.ResetMaster"
	RPCMysqlResetSlaveAll            = "MysqlRPC.ResetSlaveAll"
	RPCMysqlIsWorking                = "MysqlRPC.IsWorking"
)
View Source
const (
	RPCMysqldStatus       = "MysqldRPC.Status"
	RPCMysqldStartMonitor = "MysqldRPC.StartMonitor"
	RPCMysqldStopMonitor  = "MysqldRPC.StopMonitor"
	RPCMysqldStart        = "MysqldRPC.Start"
	RPCMysqldShutDown     = "MysqldRPC.ShutDown"
	RPCMysqldKill         = "MysqldRPC.Kill"
	RPCMysqldIsRuning     = "MysqldRPC.IsRunning"
)
View Source
const (
	RPCNodesAdd        = "NodeRPC.AddNodes"
	RPCIdleNodesAdd    = "NodeRPC.AddIdleNodes"
	RPCNodesRemove     = "NodeRPC.RemoveNodes"
	RPCIdleNodesRemove = "NodeRPC.RemoveIdleNodes"
	RPCNodes           = "NodeRPC.GetNodes"
)
View Source
const (
	RPCRaftPing                 = "RaftRPC.Ping"
	RPCRaftHeartbeat            = "RaftRPC.Heartbeat"
	RPCRaftRequestVote          = "RaftRPC.RequestVote"
	RPCRaftStatus               = "RaftRPC.Status"
	RPCRaftEnablePurgeBinlog    = "RaftRPC.EnablePurgeBinlog"
	RPCRaftDisablePurgeBinlog   = "RaftRPC.DisablePurgeBinlog"
	RPCRaftEnableCheckSemiSync  = "RaftRPC.EnableCheckSemiSync"
	RPCRaftDisableCheckSemiSync = "RaftRPC.DisableCheckSemiSync"
)
View Source
const (
	RRCServerPing   = "ServerRPC.Ping"
	RPCServerStatus = "ServerRPC.Status"
)
View Source
const (
	RPCError_MySQLUnpromotable = "RPCError_MySQLUnpromotable"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupRPCRequest

type BackupRPCRequest struct {
	// The IP of this request
	From string

	// The Backup dir of this request
	BackupDir string

	// The SSH IP of this request
	SSHHost string

	// The SSH user of this request
	SSHUser string

	// The SSH password of this request
	SSHPasswd string

	// The SSH port(default is 22) of this request
	SSHPort int

	// The Backup IOPS throttle of this request
	IOPSLimits int

	// The xtrabackup/xbstream binary dir
	XtrabackupBinDir string
}

func NewBackupRPCRequest

func NewBackupRPCRequest() *BackupRPCRequest

type BackupRPCResponse

type BackupRPCResponse struct {
	// Return code to rpc client:
	// OK or other errors
	RetCode string
}

func NewBackupRPCResponse

func NewBackupRPCResponse(code string) *BackupRPCResponse

type BackupStats

type BackupStats struct {
	// How many times backup have been called
	Backups uint64

	// How many times backup have failed
	BackupErrs uint64

	// How many times apply-log have been called
	AppLogs uint64

	// How many times apply-log have failed
	AppLogErrs uint64

	// How many times cannel have been taken
	Cancels uint64

	// The last error message of backup/applylog
	LastError string

	// The last backup command info  we call
	LastCMD string
}

type ConfigStatus

type ConfigStatus struct {
	// log
	LogLevel string

	// backup
	BackupDir        string
	BackupIOPSLimits int
	XtrabackupBinDir string

	// mysqld
	MysqldBaseDir      string
	MysqldDefaultsFile string

	// mysql
	MysqlAdmin       string
	MysqlHost        string
	MysqlPort        int
	MysqlReplUser    string
	MysqlPingTimeout int

	// raft
	RaftDataDir           string
	RaftHeartbeatTimeout  int
	RaftElectionTimeout   int
	RaftRPCRequestTimeout int
	RaftStartVipCommand   string
	RaftStopVipCommand    string
}

type GTID

type GTID struct {
	// Mysql master log file which the slave is reading
	Master_Log_File string

	// Mysql master log position which the slave has read
	Read_Master_Log_Pos uint64

	// The name of the master binary log file containing the most recent event executed by the SQL thread
	Relay_Master_Log_File string

	// Slave IO thread state
	Slave_IO_Running     bool
	Slave_IO_Running_Str string

	// Slave SQL thread state
	Slave_SQL_Running     bool
	Slave_SQL_Running_Str string

	// The GTID sets which the slave has received
	Retrieved_GTID_Set string

	// The GTID sets which the slave has executed
	Executed_GTID_Set string

	// Seconds_Behind_Master in 'show slave status'
	Seconds_Behind_Master string

	// Slave_SQL_Running_State in 'show slave status'
	// The value is identical to the State value of the SQL thread as displayed by SHOW PROCESSLIST
	Slave_SQL_Running_State string

	//The Last_Error suggests that there may be more failures
	//in the other worker threads which can be seen in the replication_applier_status_by_worker table
	//that shows each worker thread's status
	Last_Error string

	Last_IO_Error  string
	Last_SQL_Error string
}

GTID info

type HARPCRequest

type HARPCRequest struct {
	// My RPC client IP
	From string
}

func NewHARPCRequest

func NewHARPCRequest() *HARPCRequest

func (*HARPCRequest) GetFrom

func (req *HARPCRequest) GetFrom() string

type HARPCResponse

type HARPCResponse struct {
	// Return code to rpc client
	RetCode string
}

func NewHARPCResponse

func NewHARPCResponse(code string) *HARPCResponse

type MYSQLD_STATUS

type MYSQLD_STATUS string
const (
	MYSQLD_BACKUPNONE     MYSQLD_STATUS = "NONE"
	MYSQLD_BACKUPING      MYSQLD_STATUS = "BACKUPING"
	MYSQLD_BACKUPCANCELED MYSQLD_STATUS = "CANCELED"
	MYSQLD_APPLYLOGGING   MYSQLD_STATUS = "APPLYLOGGING"
	MYSQLD_SHUTDOWNING    MYSQLD_STATUS = "SHUTDOWNING"
	MYSQLD_ISRUNNING      MYSQLD_STATUS = "RUNNING"
	MYSQLD_NOTRUNNING     MYSQLD_STATUS = "NOTRUNNING"
	MYSQLD_UNKNOW         MYSQLD_STATUS = "UNKNOW"
)

type MysqlGTIDSubtractRPCRequest added in v1.1.4

type MysqlGTIDSubtractRPCRequest struct {
	// The IP of this request
	From string

	// The first parameter of the function GTID_SUBTRACT
	SubsetGTID string

	// The second parameter of the function GTID_SUBTRACT
	SetGTID string
}

func NewMysqlGTIDSubtractRPCRequest added in v1.1.4

func NewMysqlGTIDSubtractRPCRequest() *MysqlGTIDSubtractRPCRequest

type MysqlGTIDSubtractRPCResponse added in v1.1.4

type MysqlGTIDSubtractRPCResponse struct {
	// The GTID Subtract of this request
	Subtract string

	// Return code to rpc client:
	// OK or other errors
	RetCode string
}

func NewMysqlGTIDSubtractRPCResponse added in v1.1.4

func NewMysqlGTIDSubtractRPCResponse(code string) *MysqlGTIDSubtractRPCResponse

type MysqlRPCRequest

type MysqlRPCRequest struct {
	// The IP of this request
	From string
}

mysql

func NewMysqlRPCRequest

func NewMysqlRPCRequest() *MysqlRPCRequest

type MysqlRPCResponse

type MysqlRPCResponse struct {
	GTID GTID

	// Return code to rpc client:
	// OK or other errors
	RetCode string
}

func NewMysqlRPCResponse

func NewMysqlRPCResponse(code string) *MysqlRPCResponse

func (*MysqlRPCResponse) GetGTID

func (rsp *MysqlRPCResponse) GetGTID() GTID

type MysqlSetStateRPCRequest added in v1.1.4

type MysqlSetStateRPCRequest struct {
	// The IP of this request
	From string

	// The new state
	State MysqlState
}

func NewMysqlSetStateRPCRequest added in v1.1.4

func NewMysqlSetStateRPCRequest() *MysqlSetStateRPCRequest

type MysqlSetStateRPCResponse added in v1.1.4

type MysqlSetStateRPCResponse struct {
	// Return code to rpc client:
	// OK or other errors
	RetCode string
}

func NewMysqlSetStateRPCResponse added in v1.1.4

func NewMysqlSetStateRPCResponse(code string) *MysqlSetStateRPCResponse

type MysqlState added in v1.1.4

type MysqlState string

State enum.

const (
	// MysqlAlive enum.
	MysqlAlive MysqlState = "ALIVE"
	// MysqlDead enum.
	MysqlDead MysqlState = "DEAD"
)

type MysqlStats

type MysqlStats struct {
	// How many times the mysqld have been down
	// Which is measured by mysql ping
	MysqlDowns uint64
}

status

type MysqlStatusRPCRequest

type MysqlStatusRPCRequest struct {
	// The IP of this request
	From string
}

func NewMysqlStatusRPCRequest

func NewMysqlStatusRPCRequest() *MysqlStatusRPCRequest

type MysqlStatusRPCResponse

type MysqlStatusRPCResponse struct {
	// GTID info
	GTID GTID

	// Mysql Status: ALIVE or DEAD
	Status string

	// Mysql Options: READONLY or READWRITE
	Options string

	// Mysql stats
	Stats *MysqlStats

	// Return code to rpc client:
	// OK or other errors
	RetCode string
}

func NewMysqlStatusRPCResponse

func NewMysqlStatusRPCResponse(code string) *MysqlStatusRPCResponse

type MysqlUser

type MysqlUser struct {
	User      string
	Host      string
	SuperPriv string
}

type MysqlUserRPCRequest

type MysqlUserRPCRequest struct {
	// The IP of this request
	From string

	// The user which you want to create
	User string

	// The user passwd which you want to create
	Passwd string

	// the grants database
	Database string

	// the grants database table
	Table string

	// the grants host
	Host string

	// the normal privileges(comma delimited, such as "SELECT,CREATE"
	Privileges string

	// the ssl required
	SSL string
}

user

func NewMysqlUserRPCRequest

func NewMysqlUserRPCRequest() *MysqlUserRPCRequest

type MysqlUserRPCResponse

type MysqlUserRPCResponse struct {
	// the mysql user list
	Users []MysqlUser

	// Return code to rpc client:
	// OK or other errors
	RetCode string
}

func NewMysqlUserRPCResponse

func NewMysqlUserRPCResponse(code string) *MysqlUserRPCResponse

type MysqlVarRPCRequest

type MysqlVarRPCRequest struct {
	// The IP of this request
	From string

	// the system var settting sql info
	// such as "SET GLOBAL XX=YY"
	VarSql string
}

sysvar

func NewMysqlVarRPCRequest

func NewMysqlVarRPCRequest() *MysqlVarRPCRequest

type MysqlVarRPCResponse

type MysqlVarRPCResponse struct {
	// Return code to rpc client:
	// OK or other errors
	RetCode string
}

func NewMysqlVarRPCResponse

func NewMysqlVarRPCResponse(code string) *MysqlVarRPCResponse

type MysqldRPCRequest

type MysqldRPCRequest struct {
	// The IP of this request
	From string
}

mysqld

func NewMysqldRPCRequest

func NewMysqldRPCRequest() *MysqldRPCRequest

type MysqldRPCResponse

type MysqldRPCResponse struct {
	// Return code to rpc client:
	// OK or other errors
	RetCode string
}

func NewMysqldRPCResponse

func NewMysqldRPCResponse(code string) *MysqldRPCResponse

type MysqldStats

type MysqldStats struct {
	// How many times the mysqld have been started by xenon
	MysqldStarts uint64

	// How many times the mysqld have been stopped by xenon
	MysqldStops uint64

	// How many times the monitor have been started by xenon
	MonitorStarts uint64

	// How many times the monitor have been stopped by xenon
	MonitorStops uint64
}

status

type MysqldStatusRPCRequest

type MysqldStatusRPCRequest struct {
	// The IP of this request
	From string
}

func NewMysqldStatusRPCRequest

func NewMysqldStatusRPCRequest() *MysqldStatusRPCRequest

type MysqldStatusRPCResponse

type MysqldStatusRPCResponse struct {
	// Monitor Info
	MonitorInfo string

	// Mysqld Info
	MysqldInfo string

	// Backup Info
	BackupInfo string

	// Mysqld Stats
	MysqldStats *MysqldStats

	// Backup Stats
	BackupStats *BackupStats

	// Backup Status: BACKUPING/ or others
	BackupStatus MYSQLD_STATUS

	// Return code to rpc client:
	// OK or other errors
	RetCode string
}

func NewMysqldStatusRPCResponse

func NewMysqldStatusRPCResponse(code string) *MysqldStatusRPCResponse

type NodeRPCRequest

type NodeRPCRequest struct {
	// The IP of this request
	From string

	// Node endpoint lists
	Nodes []string
}

func NewNodeRPCRequest

func NewNodeRPCRequest() *NodeRPCRequest

func (*NodeRPCRequest) GetFrom

func (req *NodeRPCRequest) GetFrom() string

func (*NodeRPCRequest) GetNodes

func (req *NodeRPCRequest) GetNodes() []string

type NodeRPCResponse

type NodeRPCResponse struct {
	// The Epoch ID of the raft
	EpochID uint64

	// The View ID of the raft
	ViewID uint64

	// The State of the raft:
	// FOLLOWER/CANDIDATE/LEADER/IDLE/INVALID
	State string

	// The Leader endpoint of the cluster
	Leader string

	// The Nodes(endpoint) of the cluster
	Nodes []string

	// Return code to rpc client:
	// OK or other errors
	RetCode string
}

func NewNodeRPCResponse

func NewNodeRPCResponse(code string) *NodeRPCResponse

func (*NodeRPCResponse) GetLeader

func (rsp *NodeRPCResponse) GetLeader() string

func (*NodeRPCResponse) GetNodes

func (rsp *NodeRPCResponse) GetNodes() []string

type RAFTMYSQL_STATUS

type RAFTMYSQL_STATUS string
const (
	RAFTMYSQL_NONE               RAFTMYSQL_STATUS = ""
	RAFTMYSQL_WAITUNTILAFTERGTID RAFTMYSQL_STATUS = "WaitUntilAfterGTID"
)

type Raft

type Raft struct {
	// The Epoch ID of the raft
	EpochID uint64

	// The View ID of the raft
	ViewID uint64

	// The Leader endpoint of this raft stored
	Leader string

	// The endpoint of the rpc call from
	From string

	// The endpoint of the rpc call to
	To string

	// The state string(LEADER/CANCIDATE/FOLLOWER/IDLE/INVALID)
	State string
}

raft

type RaftRPCRequest

type RaftRPCRequest struct {
	Raft      Raft
	Repl      Repl
	GTID      GTID
	Peers     []string
	IdlePeers []string
}

func NewRaftRPCRequest

func NewRaftRPCRequest() *RaftRPCRequest

func (*RaftRPCRequest) GetEpochID

func (req *RaftRPCRequest) GetEpochID() uint64

func (*RaftRPCRequest) GetFrom

func (req *RaftRPCRequest) GetFrom() string

func (*RaftRPCRequest) GetGTID

func (req *RaftRPCRequest) GetGTID() GTID

func (*RaftRPCRequest) GetIdlePeers added in v1.0.9

func (req *RaftRPCRequest) GetIdlePeers() []string

func (*RaftRPCRequest) GetPeers

func (req *RaftRPCRequest) GetPeers() []string

func (*RaftRPCRequest) GetRepl

func (req *RaftRPCRequest) GetRepl() Repl

func (*RaftRPCRequest) GetViewID

func (req *RaftRPCRequest) GetViewID() uint64

func (*RaftRPCRequest) SetFrom

func (req *RaftRPCRequest) SetFrom(from string)

type RaftRPCResponse

type RaftRPCResponse struct {
	Raft                  Raft
	GTID                  GTID
	Relay_Master_Log_File string
	RetCode               string
}

func NewRaftRPCResponse

func NewRaftRPCResponse(code string) *RaftRPCResponse

func (*RaftRPCResponse) GetEpochID

func (rsp *RaftRPCResponse) GetEpochID() uint64

func (*RaftRPCResponse) GetFrom

func (rsp *RaftRPCResponse) GetFrom() string

func (*RaftRPCResponse) GetGTID

func (rsp *RaftRPCResponse) GetGTID() GTID

func (*RaftRPCResponse) GetLeader

func (rsp *RaftRPCResponse) GetLeader() string

func (*RaftRPCResponse) GetViewID

func (rsp *RaftRPCResponse) GetViewID() uint64

func (*RaftRPCResponse) SetFrom

func (rsp *RaftRPCResponse) SetFrom(from string)

type RaftStats

type RaftStats struct {
	// How many times the Pings called
	Pings uint64

	// How many times the HaEnables called
	HaEnables uint64

	// How many times the candidate promotes to a leader
	LeaderPromotes uint64

	// How many times the leader degrade to a follower
	LeaderDegrades uint64

	// How many times the leader got hb request from other leader
	LeaderGetHeartbeatRequests uint64

	// How many times the leader got vote request from others candidate
	LeaderGetVoteRequests uint64

	// How many times the leader purged binlogs
	LeaderPurgeBinlogs uint64

	// How many times the leader purged binlogs fails
	LeaderPurgeBinlogFails uint64

	// How many times the leader got minority hb-ack
	LessHearbeatAcks uint64

	// How many times the follower promotes to a candidate
	CandidatePromotes uint64

	// How many times the candidate degrades to a follower
	CandidateDegrades uint64

	// How long of the state up
	StateUptimes uint64

	// The state of mysql: READONLY/WRITEREAD/DEAD
	RaftMysqlStatus RAFTMYSQL_STATUS
}

status

type RaftStatusRPCRequest

type RaftStatusRPCRequest struct {
}

func NewRaftStatusRPCRequest

func NewRaftStatusRPCRequest() *RaftStatusRPCRequest

type RaftStatusRPCResponse

type RaftStatusRPCResponse struct {
	Stats     *RaftStats
	IdleCount uint64

	// The state info of this raft
	// FOLLOWER/CANDIDATE/LEADER/IDLE
	State string

	// Return code to rpc client:
	// OK or other errors
	RetCode string
}

func NewRaftStatusRPCResponse

func NewRaftStatusRPCResponse(code string) *RaftStatusRPCResponse

type Repl

type Repl struct {
	// Mysql master IP
	Master_Host string

	// Mysql master port
	Master_Port int

	// Mysql replication user
	Repl_User string

	// Mysql replication password
	Repl_Password string
}

replication info

type ServerRPCRequest

type ServerRPCRequest struct {
	From string
	Msg  string
}

func NewServerRPCRequest

func NewServerRPCRequest() *ServerRPCRequest

func (*ServerRPCRequest) GetFrom

func (req *ServerRPCRequest) GetFrom() string

type ServerRPCResponse

type ServerRPCResponse struct {
	Config        *ConfigStatus
	Stats         *ServerStats
	ServerUptimes uint64
	RetCode       string
}

func NewServerRPCResponse

func NewServerRPCResponse(code string) *ServerRPCResponse

type ServerStats

type ServerStats struct {
	Uptimes uint64
}

stats

Jump to

Keyboard shortcuts

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