Documentation ¶
Index ¶
- Constants
- Variables
- func ResetSlaveAlgorithm(app *App, node *mysql.Node, master string, channel string) error
- func StartSlaveAlgorithm(app *App, node *mysql.Node, _ string, channel string) error
- type App
- func (app *App) CheckAsyncSwitchAllowed(node *mysql.Node, switchover *Switchover) bool
- func (app *App) ClearRecovery(host string) error
- func (app *App) CliAbort() int
- func (app *App) CliDisableMaintenance(waitTimeout time.Duration) int
- func (app *App) CliEnableMaintenance(waitTimeout time.Duration) int
- func (app *App) CliGetMaintenance() int
- func (app *App) CliHostAdd(host string, streamFrom *string, priority *int64, dryRun bool, ...) int
- func (app *App) CliHostList() int
- func (app *App) CliHostRemove(host string) int
- func (app *App) CliInfo(short bool) int
- func (app *App) CliState(short bool) int
- func (app *App) CliSwitch(switchFrom, switchTo string, waitTimeout time.Duration) int
- func (app *App) FailSwitchover(switchover *Switchover, err error) error
- func (app *App) FinishSwitchover(switchover *Switchover, switchErr error) error
- func (app *App) GetActiveNodes() ([]string, error)
- func (app *App) GetClusterCascadeFqdnsFromDcs() ([]string, error)
- func (app *App) GetHostsOnRecovery() ([]string, error)
- func (app *App) GetLastShutdownNodeTime() (time.Time, error)
- func (app *App) GetLastSwitchover() Switchover
- func (app *App) GetMaintenance() (*Maintenance, error)
- func (app *App) GetMasterHostFromDcs() (string, error)
- func (app *App) GetReplMonTS() (string, error)
- func (app *App) GetResetupStatus(host string) (mysql.ResetupStatus, error)
- func (app *App) IsRecoveryNeeded(host string) bool
- func (app *App) IssueFailover(master string) error
- func (app *App) MarkReplicationRunning(node *mysql.Node, channel string)
- func (app *App) Run() int
- func (app *App) SetMasterHost(master string) (string, error)
- func (app *App) SetRecovery(host string) error
- func (app *App) SetReplMonTS(ts string) error
- func (app *App) SetResetupStatus()
- func (app *App) StartSwitchover(switchover *Switchover) error
- func (app *App) TryRepairReplication(node *mysql.Node, master string, channel string)
- func (app *App) UpdateLastShutdownNodeTime() error
- type DaemonState
- type DiskState
- type Maintenance
- type MasterState
- type NodeState
- type RepairReplicationAlgorithm
- type ReplicationRepairAlgorithmType
- type ReplicationRepairState
- type SemiSyncState
- type SlaveState
- type Switchover
- type SwitchoverResult
Constants ¶
const ( // CauseManual means switchover was issued via command line CauseManual = "manual" // CauseWorker means switchover was initiated via MDB worker (set directly to dcs) CauseWorker = "worker" // CauseAuto means failover was started automatically by failure detection process CauseAuto = "auto" )
Variables ¶
Functions ¶
func ResetSlaveAlgorithm ¶
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is main application structure
func (*App) CheckAsyncSwitchAllowed ¶
func (app *App) CheckAsyncSwitchAllowed(node *mysql.Node, switchover *Switchover) bool
func (*App) ClearRecovery ¶
func (*App) CliDisableMaintenance ¶
CliDisableMaintenance disables maintenance mode
func (*App) CliEnableMaintenance ¶
CliEnableMaintenance enables maintenance mode
func (*App) CliGetMaintenance ¶
CliGetMaintenance prints on/off depending on current maintenance status
func (*App) CliHostAdd ¶
func (app *App) CliHostAdd(host string, streamFrom *string, priority *int64, dryRun bool, skipMySQLCheck bool) int
CliHostAdd add hosts to the list of managed HA/cascade hosts
func (*App) CliHostList ¶
CliHostList prints list of managed HA/cascade hosts
func (*App) CliHostRemove ¶
CliHostRemove removes hosts from the list of managed HA/cascade hosts
func (*App) CliSwitch ¶
CliSwitch performs manual switch-over of the master node nolint: gocyclo, funlen
func (*App) FailSwitchover ¶
func (app *App) FailSwitchover(switchover *Switchover, err error) error
Fail current switchover, it will be repeated next cycle
func (*App) FinishSwitchover ¶
func (app *App) FinishSwitchover(switchover *Switchover, switchErr error) error
FinishSwitchover finish current switchover and write the result
func (*App) GetActiveNodes ¶
GetActiveNodes returns master + alive running replicas
func (*App) GetClusterCascadeFqdnsFromDcs ¶
func (*App) GetHostsOnRecovery ¶
func (*App) GetLastSwitchover ¶
func (app *App) GetLastSwitchover() Switchover
func (*App) GetMaintenance ¶
func (app *App) GetMaintenance() (*Maintenance, error)
func (*App) GetMasterHostFromDcs ¶
func (*App) GetReplMonTS ¶
func (*App) GetResetupStatus ¶
func (app *App) GetResetupStatus(host string) (mysql.ResetupStatus, error)
func (*App) IsRecoveryNeeded ¶
func (*App) IssueFailover ¶
func (*App) MarkReplicationRunning ¶
func (*App) SetRecovery ¶
func (*App) SetReplMonTS ¶
func (*App) SetResetupStatus ¶
func (app *App) SetResetupStatus()
func (*App) StartSwitchover ¶
func (app *App) StartSwitchover(switchover *Switchover) error
func (*App) TryRepairReplication ¶
func (*App) UpdateLastShutdownNodeTime ¶
type DaemonState ¶
type Maintenance ¶
type Maintenance struct { InitiatedBy string `json:"initiated_by"` InitiatedAt time.Time `json:"initiated_at"` MySyncPaused bool `json:"mysync_paused"` ShouldLeave bool `json:"should_leave"` }
Maintenance struct presence means that cluster under manual control
func (*Maintenance) String ¶
func (m *Maintenance) String() string
type MasterState ¶
type MasterState struct {
ExecutedGtidSet string `json:"executed_gtid_set"`
}
MasterState contains master specific info
type NodeState ¶
type NodeState struct { CheckBy string `json:"check_by"` CheckAt time.Time `json:"check_at"` PingOk bool `json:"ping_ok"` PingDubious bool `json:"ping_dubious"` IsMaster bool `json:"is_master"` IsReadOnly bool `json:"is_readonly"` IsSuperReadOnly bool `json:"is_super_readonly"` IsOffline bool `json:"is_offline"` IsCascade bool `json:"is_cascade"` IsFileSystemReadonly bool `json:"is_file_system_readonly"` Error string `json:"error"` DiskState *DiskState `json:"disk_state"` DaemonState *DaemonState `json:"daemon_state"` MasterState *MasterState `json:"master_state"` SlaveState *SlaveState `json:"slave_state"` SemiSyncState *SemiSyncState `json:"semi_sync_state"` ShowOnlyGTIDDiff bool }
NodeState contains status check performed by some mysync process
func (*NodeState) CalcGTIDDiffWithMaster ¶
func (*NodeState) IsReplicationPermanentlyBroken ¶
type ReplicationRepairAlgorithmType ¶
type ReplicationRepairAlgorithmType int
const ( StartSlave ReplicationRepairAlgorithmType = iota ResetSlave )
type ReplicationRepairState ¶
type ReplicationRepairState struct { LastAttempt time.Time History map[ReplicationRepairAlgorithmType]int LastGTIDExecuted string }
type SemiSyncState ¶
type SemiSyncState struct { MasterEnabled bool `json:"master_enabled"` SlaveEnabled bool `json:"slave_enabled"` WaitSlaveCount int `json:"wait_slave_count"` }
SemiSyncState contains semi sync host settings
type SlaveState ¶
type SlaveState struct { MasterHost string `json:"master_host"` RetrievedGtidSet string `json:"retrieved_gtid_get"` ExecutedGtidSet string `json:"executed_gtid_set"` ReplicationLag *float64 `json:"replication_lag"` ReplicationState string `json:"replication_state"` MasterLogFile string `json:"master_log_file"` MasterLogPos int64 `json:"master_log_pos"` LastIOErrno int `json:"last_io_errno"` LastSQLErrno int `json:"last_sql_errno"` }
SlaveState contains slave specific info. Master always has this state empty
func (*SlaveState) FromReplicaStatus ¶
func (ns *SlaveState) FromReplicaStatus(replStatus mysql.ReplicaStatus)
type Switchover ¶
type Switchover struct { From string `json:"from"` To string `json:"to"` Cause string `json:"cause"` InitiatedBy string `json:"initiated_by"` InitiatedAt time.Time `json:"initiated_at"` StartedBy string `json:"started_by"` StartedAt time.Time `json:"started_at"` Result *SwitchoverResult `json:"result"` RunCount int `json:"run_count,omitempty"` }
Switchover contains info about currently running or scheduled switchover/failover process
func (*Switchover) String ¶
func (sw *Switchover) String() string