mysql

package
v0.0.0-...-0f91579 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SlaveIOThreadRunningField  = "Slave_IO_Running"
	SlaveSQLThreadRunningField = "Slave_SQL_Running"
	IsRunningValue             = "Yes"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DBORepo

type DBORepo struct {
	Database middleware.Pool
}

func NewDBORepo

func NewDBORepo(db middleware.Pool) *DBORepo

NewDBORepo returns a new *DBORepo

func NewDBORepoWithDefault

func NewDBORepoWithDefault() *DBORepo

NewDBORepoWithDefault returns a new *DBORepo with default middleware.Pool

func (*DBORepo) Execute

func (dr *DBORepo) Execute(command string, args ...interface{}) (middleware.Result, error)

Execute executes given command and placeholders on the middleware

func (*DBORepo) GetLock

func (dr *DBORepo) GetLock(operationID int, addrs []string) error

GetLock gets the operation lock of the given host info

func (*DBORepo) GetOperationDetails

func (dr *DBORepo) GetOperationDetails(operationID int) ([]*OperationDetail, error)

GetOperationDetails gets the mysql operation detail from the middleware

func (*DBORepo) GetOperationHistory

func (dr *DBORepo) GetOperationHistory(id int) (*OperationInfo, error)

GetOperationHistory gets the mysql operation history from the middleware

func (*DBORepo) InitOperationDetail

func (dr *DBORepo) InitOperationDetail(operationID int, hostIP string, portNum int) (int, error)

InitOperationDetail initializes the mysql operation detail in the middleware

func (*DBORepo) InitOperationHistory

func (dr *DBORepo) InitOperationHistory(operationType int, addrs []string) (int, error)

InitOperationHistory initializes the mysql operation history in the middleware

func (*DBORepo) ReleaseLock

func (dr *DBORepo) ReleaseLock(operationID int) error

ReleaseLock releases the operation lock of the given host info

func (*DBORepo) Transaction

func (dr *DBORepo) Transaction() (middleware.Transaction, error)

Transaction returns a middleware.Transaction that could execute multiple commands as a transaction

func (*DBORepo) UpdateOperationDetail

func (dr *DBORepo) UpdateOperationDetail(operationDetailID int, status int, message string) error

UpdateOperationDetail updates the mysql operation detail in the middleware

func (*DBORepo) UpdateOperationHistory

func (dr *DBORepo) UpdateOperationHistory(id int, status int, message string) error

UpdateOperationHistory updates the mysql operation history in the middleware

type Engine

type Engine struct {
	Mode        mode.Mode              `json:"mode"`
	Addrs       []string               `json:"addrs"`
	MySQLServer *parameter.MySQLServer `json:"mysql_server"`
	PMMClient   *parameter.PMMClient   `json:"pmm_client"`
	// contains filtered or unexported fields
}

func NewEngine

func NewEngine(dboRepo *DBORepo, mysqlVersion *version.Version, m mode.Mode, addrs []string, mysqlServer *parameter.MySQLServer, pmmClient *parameter.PMMClient) *Engine

NewEngine returns a new *Engine

func NewEngineWithDefault

func NewEngineWithDefault(mysqlVersion *version.Version, m mode.Mode, addrs []string, mysqlServer *parameter.MySQLServer, pmmClient *parameter.PMMClient) *Engine

NewEngineWithDefault returns a new *Engine with default values

func (*Engine) ConfigureGroupReplication

func (e *Engine) ConfigureGroupReplication() error

ConfigureGroupReplication configures the group replication

func (*Engine) ConfigureReplica

func (e *Engine) ConfigureReplica(addr, sourceHostIP string, sourcePortNum int) error

ConfigureReplica configures the replication

func (*Engine) InitMySQLInstance

func (e *Engine) InitMySQLInstance() error

InitMySQLInstance initializes the mysql instance

func (*Engine) InitOS

func (e *Engine) InitOS() error

InitOS initializes the os

func (*Engine) InitOSExecutor

func (e *Engine) InitOSExecutor() error

InitOSExecutor initializes the ssh connection

func (*Engine) InitPMMClient

func (e *Engine) InitPMMClient() error

InitPMMClient initializes the pmm client

func (*Engine) Install

func (e *Engine) Install(operationID int) error

Install installs mysql to the hosts

func (*Engine) InstallSingleInstance

func (e *Engine) InstallSingleInstance(hostIP string, portNum int, isSource bool) error

InstallSingleInstance installs the single instance

type OSExecutor

type OSExecutor struct {
	*ssh.Conn
	// contains filtered or unexported fields
}

func NewOSExecutor

func NewOSExecutor(sshConn *ssh.Conn, mysqlVersion *version.Version, mysqlServer *parameter.MySQLServer) *OSExecutor

NewOSExecutor returns a new *OSExecutor

func (*OSExecutor) ConfigurePathEnv

func (ose *OSExecutor) ConfigurePathEnv() error

ConfigurePathEnv configures the path environment variable

func (*OSExecutor) GetMySQLPIDList

func (ose *OSExecutor) GetMySQLPIDList() ([]int, error)

GetMySQLPIDList gets the mysql pid list

func (*OSExecutor) Init

func (ose *OSExecutor) Init() error

Init initializes the os

func (*OSExecutor) InitDir

func (ose *OSExecutor) InitDir() error

InitDir initializes the directory

func (*OSExecutor) InitExecutor

func (ose *OSExecutor) InitExecutor() error

InitExecutor initializes the os executor

func (*OSExecutor) InitUserAndGroup

func (ose *OSExecutor) InitUserAndGroup() error

InitUserAndGroup initializes the user and group

func (*OSExecutor) InstallMySQLBinary

func (ose *OSExecutor) InstallMySQLBinary() error

InstallMySQLBinary installs the mysql binary

func (*OSExecutor) InstallRPM

func (ose *OSExecutor) InstallRPM() error

InstallRPM installs the rpm

func (*OSExecutor) Precheck

func (ose *OSExecutor) Precheck() error

Precheck checks the os

type OperationDetail

type OperationDetail struct {
	ID             int       `json:"id" middleware:"id"`
	OperationID    int       `json:"operation_id" middleware:"operation_id"`
	HostIP         string    `json:"host_ip" middleware:"host_ip"`
	PortNum        int       `json:"port_num" middleware:"port_num"`
	Status         int       `json:"status" middleware:"status"`
	Message        string    `json:"message" middleware:"message"`
	DelFlag        int       `json:"del_flag" middleware:"del_flag"`
	CreateTime     time.Time `json:"create_time" middleware:"create_time"`
	LastUpdateTime time.Time `json:"last_update_time" middleware:"last_update_time"`
}

func NewOperationDetailWithDefault

func NewOperationDetailWithDefault() *OperationDetail

NewOperationDetailWithDefault returns a new *OperationDetail with default value

type OperationInfo

type OperationInfo struct {
	ID             int       `json:"id" middleware:"id"`
	OperationType  int       `json:"operation_type" middleware:"operation_type"`
	Addrs          string    `json:"addrs" middleware:"addrs"`
	Status         int       `json:"status" middleware:"status"`
	Message        string    `json:"message" middleware:"message"`
	DelFlag        int       `json:"del_flag" middleware:"del_flag"`
	CreateTime     time.Time `json:"create_time" middleware:"create_time"`
	LastUpdateTime time.Time `json:"last_update_time" middleware:"last_update_time"`
}

func NewOperationInfoWithDefault

func NewOperationInfoWithDefault() *OperationInfo

NewOperationInfoWithDefault returns a new *OperationInfo with default value

type PMMExecutor

type PMMExecutor struct {
	// contains filtered or unexported fields
}

func NewPMMExecutor

func NewPMMExecutor(sshConn *ssh.Conn, hostIP string, portNum int, pmmClient *parameter.PMMClient) *PMMExecutor

NewPMMExecutor returns a new *PMMExecutor

func (*PMMExecutor) AddService

func (pe *PMMExecutor) AddService() error

AddService adds service to pmm server

func (*PMMExecutor) CheckConfiguration

func (pe *PMMExecutor) CheckConfiguration() (bool, error)

CheckConfiguration checks if pmm is configured

func (*PMMExecutor) CheckPMMClient

func (pe *PMMExecutor) CheckPMMClient() (bool, error)

CheckPMMClient checks if pmm client is installed

func (*PMMExecutor) CheckServiceExists

func (pe *PMMExecutor) CheckServiceExists() (bool, error)

CheckServiceExists checks if the service exists

func (*PMMExecutor) ConfigureServer

func (pe *PMMExecutor) ConfigureServer() error

ConfigureServer configures pmm server

func (*PMMExecutor) Init

func (pe *PMMExecutor) Init() error

Init initializes pmm client on the host

func (*PMMExecutor) Install

func (pe *PMMExecutor) Install() error

Install installs pmm client to the host

func (*PMMExecutor) StartClient

func (pe *PMMExecutor) StartClient() error

StartClient starts pmm client

type Service

type Service struct {
	*DBORepo
	Engine *Engine
}

func NewService

func NewService(repo *DBORepo, engine *Engine) *Service

NewService returns a new *Service

func NewServiceWithDefault

func NewServiceWithDefault(engine *Engine) *Service

NewServiceWithDefault returns a new *Service with default value

func (*Service) Install

func (s *Service) Install() error

Install installs the mysql to the target hosts

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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