Documentation ¶
Index ¶
- func CheckAllRelayLogsExecuted(ctx context.Context, db *sqlx.DB, status *MySQLReplicaStatus) (bool, error)
- func GetLatestInstance(ctx context.Context, db *sqlx.DB, status []MySQLInstanceStatus) (*int, error)
- type DataBaseAccessor
- type Infrastructure
- type IntermediatePrimaryOptions
- type MySQLAccessor
- type MySQLAccessorConfig
- type MySQLCloneStateStatus
- type MySQLClusterStatus
- type MySQLGlobalVariablesStatus
- type MySQLInstanceStatus
- type MySQLPrimaryStatus
- type MySQLReplicaStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLatestInstance ¶
Types ¶
type DataBaseAccessor ¶
type Infrastructure ¶
type Infrastructure struct {
// contains filtered or unexported fields
}
func NewInfrastructure ¶
func NewInfrastructure(cli client.Client, acc DataBaseAccessor, password string, addrs []string) Infrastructure
func (Infrastructure) GetClient ¶
func (i Infrastructure) GetClient() client.Client
type IntermediatePrimaryOptions ¶ added in v0.3.0
type IntermediatePrimaryOptions struct { PrimaryHost string `db:"MasterHost"` PrimaryUser string `db:"MasterUser"` PrimaryPassword string `db:"MasterPassword"` PrimaryPort int `db:"MasterPort"` }
IntermediatePrimaryOptions is the parameters to connect the external instance
func GetIntermediatePrimaryOptions ¶ added in v0.3.0
func GetIntermediatePrimaryOptions(ctx context.Context, cli client.Client, cluster *mocov1alpha1.MySQLCluster) (*IntermediatePrimaryOptions, error)
type MySQLAccessor ¶
type MySQLAccessor struct {
// contains filtered or unexported fields
}
MySQLAccessor contains MySQL connection configurations and sqlx.db
func NewMySQLAccessor ¶
func NewMySQLAccessor(config *MySQLAccessorConfig) *MySQLAccessor
NewMySQLAccessor creates new MySQLAccessor
func (*MySQLAccessor) Get ¶
func (acc *MySQLAccessor) Get(addr, user, password string) (*sqlx.DB, error)
Get connects a database with specified parameters
func (*MySQLAccessor) Remove ¶
func (acc *MySQLAccessor) Remove(addr string)
Remove cleans staled connections
type MySQLAccessorConfig ¶
type MySQLAccessorConfig struct { ConnMaxLifeTime time.Duration ConnectionTimeout time.Duration ReadTimeout time.Duration }
MySQLAccessorConfig contains MySQL connection configurations
type MySQLCloneStateStatus ¶
type MySQLCloneStateStatus struct {
State sql.NullString `db:"state"`
}
MySQLCloneStateStatus defines the observed clone state of a MySQL instance
type MySQLClusterStatus ¶
type MySQLClusterStatus struct { InstanceStatus []MySQLInstanceStatus Latest *int IntermediatePrimaryOptions *IntermediatePrimaryOptions }
MySQLClusterStatus defines the observed state of MySQLCluster
func GetMySQLClusterStatus ¶
func GetMySQLClusterStatus(ctx context.Context, log logr.Logger, infra Infrastructure, cluster *mocov1alpha1.MySQLCluster) (*MySQLClusterStatus, error)
GetMySQLClusterStatus gathers current cluster status and return it. If the operator failed to gather status of individual replica, the Available field of corresponding replica becomes false. If the operator failed to gather status of cluster itself, returns error.
type MySQLGlobalVariablesStatus ¶
type MySQLGlobalVariablesStatus struct { ReadOnly bool `db:"@@read_only"` SuperReadOnly bool `db:"@@super_read_only"` RplSemiSyncMasterWaitForSlaveCount int `db:"@@rpl_semi_sync_master_wait_for_slave_count"` CloneValidDonorList sql.NullString `db:"@@clone_valid_donor_list"` }
MySQLGlobalVariablesStatus defines the observed global variable state of a MySQL instance
type MySQLInstanceStatus ¶
type MySQLInstanceStatus struct { Available bool PrimaryStatus *MySQLPrimaryStatus ReplicaStatus *MySQLReplicaStatus GlobalVariablesStatus *MySQLGlobalVariablesStatus CloneStateStatus *MySQLCloneStateStatus Role string AllRelayLogExecuted bool }
MySQLInstanceStatus defines the observed state of a MySQL instance
type MySQLPrimaryStatus ¶
type MySQLPrimaryStatus struct { ExecutedGtidSet string `db:"Executed_Gtid_Set"` // All of variables from here are NOT used in MOCO's reconcile File string `db:"File"` Position string `db:"Position"` BinlogDoDB string `db:"Binlog_Do_DB"` BinlogIgnoreDB string `db:"Binlog_Ignore_DB"` }
MySQLPrimaryStatus defines the observed state of a primary
func GetMySQLPrimaryStatus ¶
type MySQLReplicaStatus ¶
type MySQLReplicaStatus struct { LastIoErrno int `db:"Last_IO_Errno"` LastIoError string `db:"Last_IO_Error"` LastSQLErrno int `db:"Last_SQL_Errno"` LastSQLError string `db:"Last_SQL_Error"` MasterHost string `db:"Master_Host"` RetrievedGtidSet string `db:"Retrieved_Gtid_Set"` ExecutedGtidSet string `db:"Executed_Gtid_Set"` SlaveIORunning string `db:"Slave_IO_Running"` SlaveSQLRunning string `db:"Slave_SQL_Running"` // All of variables from here are NOT used in MOCO's reconcile SlaveIOState string `db:"Slave_IO_State"` MasterUser string `db:"Master_User"` MasterPort int `db:"Master_Port"` ConnectRetry int `db:"Connect_Retry"` MasterLogFile string `db:"Master_Log_File"` ReadMasterLogPos int `db:"Read_Master_Log_Pos"` RelayLogFile string `db:"Relay_Log_File"` RelayLogPos int `db:"Relay_Log_Pos"` RelayMasterLogFile string `db:"Relay_Master_Log_File"` ReplicateDoDB string `db:"Replicate_Do_DB"` ReplicateIgnoreDB string `db:"Replicate_Ignore_DB"` ReplicateDoTable string `db:"Replicate_Do_Table"` ReplicateIgnoreTable string `db:"Replicate_Ignore_Table"` ReplicateWildDoTable string `db:"Replicate_Wild_Do_Table"` ReplicateWildIgnoreTable string `db:"Replicate_Wild_Ignore_Table"` LastErrno int `db:"Last_Errno"` LastError string `db:"Last_Error"` SkipCounter int `db:"Skip_Counter"` ExecMasterLogPos int `db:"Exec_Master_Log_Pos"` RelayLogSpace int `db:"Relay_Log_Space"` UntilCondition string `db:"Until_Condition"` UntilLogFile string `db:"Until_Log_File"` UntilLogPos int `db:"Until_Log_Pos"` MasterSSLAllowed string `db:"Master_SSL_Allowed"` MasterSSLCAFile string `db:"Master_SSL_CA_File"` MasterSSLCAPath string `db:"Master_SSL_CA_Path"` MasterSSLCert string `db:"Master_SSL_Cert"` MasterSSLCipher string `db:"Master_SSL_Cipher"` MasterSSLKey string `db:"Master_SSL_Key"` SecondsBehindMaster sql.NullInt64 `db:"Seconds_Behind_Master"` MasterSSLVerifyServerCert string `db:"Master_SSL_Verify_Server_Cert"` ReplicateIgnoreServerIds string `db:"Replicate_Ignore_Server_Ids"` MasterServerID int `db:"Master_Server_Id"` MasterUUID string `db:"Master_UUID"` MasterInfoFile string `db:"Master_Info_File"` SQLDelay int `db:"SQL_Delay"` SQLRemainingDelay sql.NullInt64 `db:"SQL_Remaining_Delay"` SlaveSQLRunningState string `db:"Slave_SQL_Running_State"` MasterRetryCount int `db:"Master_Retry_Count"` MasterBind string `db:"Master_Bind"` LastIOErrorTimestamp string `db:"Last_IO_Error_Timestamp"` LastSQLErrorTimestamp string `db:"Last_SQL_Error_Timestamp"` MasterSSLCrl string `db:"Master_SSL_Crl"` MasterSSLCrlpath string `db:"Master_SSL_Crlpath"` AutoPosition string `db:"Auto_Position"` ReplicateRewriteDB string `db:"Replicate_Rewrite_DB"` ChannelName string `db:"Channel_Name"` MasterTLSVersion string `db:"Master_TLS_Version"` Masterpublickeypath string `db:"Master_public_key_path"` Getmasterpublickey string `db:"Get_master_public_key"` NetworkNamespace string `db:"Network_Namespace"` }
MySQLReplicaStatus defines the observed state of a replica