Documentation ¶
Index ¶
- Constants
- type Common
- type MySQLD
- func (md *MySQLD) GetConfig(v *version.Version, m mode.Mode) ([]byte, error)
- func (md *MySQLD) GetConfigWithTitle(title string, v *version.Version, m mode.Mode) ([]byte, error)
- func (md *MySQLD) SetSemiSyncReplicaEnabled(semiSyncReplicaEnabled int)
- func (md *MySQLD) SetSemiSyncSourceEnabled(semiSyncSourceEnabled int)
- type MySQLServer
- func (ms *MySQLServer) GetCommon() *Common
- func (ms *MySQLServer) GetCommonConfig() ([]byte, error)
- func (ms *MySQLServer) GetConfig(v *version.Version, m mode.Mode) ([]byte, error)
- func (ms *MySQLServer) GetConfigWithTitle(title string, v *version.Version, m mode.Mode) ([]byte, error)
- func (ms *MySQLServer) GetInitUserSQL() (string, error)
- func (ms *MySQLServer) GetMySQLD() *MySQLD
- func (ms *MySQLServer) GetMySQLDConfig(v *version.Version, m mode.Mode) ([]byte, error)
- func (ms *MySQLServer) GetMySQLDConfigWithTitle(title string, v *version.Version, m mode.Mode) ([]byte, error)
- func (ms *MySQLServer) InitWithHostInfo(hostIP string, portNum int, isSource bool) error
- func (ms *MySQLServer) Marshal() ([]byte, error)
- func (ms *MySQLServer) SetSemiSyncReplicaEnabled(semiSyncReplicaEnabled int)
- func (ms *MySQLServer) SetSemiSyncSourceEnabled(semiSyncSourceEnabled int)
- func (ms *MySQLServer) SetVersion(version string)
- func (ms *MySQLServer) Unmarshal(data []byte) error
- func (ms *MySQLServer) WriteConfig(configPath string, data []byte) error
- type PMMClient
Constants ¶
const ( DefaultServerID = 3306000001 DefaultDataDirBaseName = "/data/mysql/data" DefaultLogDirBaseName = "/data/mysql/data" DefaultSemiSyncEnabled = 1 DefaultSemiSyncDisabled = 0 DefaultSemiSyncSourceTimeout = 10000 DefaultGroupReplicationConsistency = "eventual" DefaultGroupReplicationFlowControlMode = "disabled" DefaultGroupReplicationMemberWeight = 50 DefaultBinaryDirBaseTemplate = "/data/mysql/mysql%s" DefaultBinlogExpireLogsSeconds = 604800 DefaultBinlogExpireLogsDays = 7 DefaultBackupDir = "/data/backup" DefaultMaxConnections = 2000 DefaultInnodbIOCapacity = 1000 DefaultInnodbIOCapacityMax = 2000 DefaultServerIDTemplate = "%d%03s%03s" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Common ¶
type Common struct { PortNum int `json:"port_num" config:"port_num"` DataDirBaseName string `json:"data_dir_base_name" config:"data_dir_base_name"` DataDirBase string `json:"data_dir_base" config:"data_dir_base"` ClientUser string `json:"client_user" config:"client_user"` ClientPass string `json:"client_pass" config:"client_pass"` MySQLDMultiUser string `json:"mysqld_multi_user" config:"mysqld_multi_user"` MySQLDMultiPass string `json:"mysqld_multi_pass" config:"mysqld_multi_pass"` }
func NewCommon ¶
func NewCommon(portNum int, dataDirBaseName, clientUser, clientPass, mysqldMultiUser, mysqldMultiPass string) *Common
NewCommon returns a new *Common
type MySQLD ¶
type MySQLD struct { Version string `json:"version" config:"version"` Title string `json:"title" config:"title"` HostIP string `json:"host_ip" config:"host_ip"` PortNum int `json:"port_num" config:"port_num"` BinaryDirBase string `json:"binary_dir_base" config:"binary_dir_base"` DataDirBaseName string `json:"data_dir_base_name" config:"data_dir_base_name"` DataDirBase string `json:"data_dir_base" config:"data_dir_base"` LogDirBaseName string `json:"log_dir_base_name" config:"log_dir_base_name"` LogDirBase string `json:"log_dir_base" config:"log_dir_base"` SemiSyncSourceEnabled int `json:"semi_sync_source_enabled" config:"semi_sync_source_enabled"` SemiSyncReplicaEnabled int `json:"semi_sync_replica_enabled" config:"semi_sync_replica_enabled"` SemiSyncSourceTimeout int `json:"semi_sync_source_timeout" config:"semi_sync_source_timeout"` GroupReplicationConsistency string `json:"group_replication_consistency" config:"group_replication_consistency"` GroupReplicationFlowControlMode string `json:"group_replication_flow_control_mode" config:"group_replication_flow_control_mode"` GroupReplicationMemberWeight int `json:"group_replication_member_weight" config:"group_replication_member_weight"` ServerID int `json:"server_id" config:"server_id"` BinlogExpireLogsSeconds int `json:"binlog_expire_logs_seconds" config:"binlog_expire_logs_seconds"` BinlogExpireLogsDays int `json:"binlog_expire_logs_days" config:"binlog_expire_logs_days"` BackupDir string `json:"backup_dir" config:"backup_dir"` MaxConnections int `json:"max_connections" config:"max_connections"` InnodbBufferPoolSize string `json:"innodb_buffer_pool_size" config:"innodb_buffer_pool_size"` InnodbIOCapacity int `json:"innodb_io_capacity" config:"innodb_io_capacity"` InnodbIOCapacityMax int `json:"innodb_io_capacity_max" config:"innodb_io_capacity_max"` }
func NewMySQLD ¶
func NewMySQLD(version, hostIP string, portNum int, binaryDirBase, dataDirBaseName, logDirBaseName string, semiSyncSourceEnabled, semiSyncReplicaEnabled, semiSyncSourceTimeout int, groupReplicationConsistency, groupReplicationFlowControlMode string, groupReplicationMemberWeight int, serverID, binlogExpireLogsSeconds, binlogExpireLogsDays int, backupDir string, maxConnections int, innodbBufferPoolSize string, innodbIOCapacity int) *MySQLD
NewMySQLD returns a new *MySQLD
func (*MySQLD) GetConfigWithTitle ¶
GetConfigWithTitle returns the configuration of MySQLD with title
func (*MySQLD) SetSemiSyncReplicaEnabled ¶
SetSemiSyncReplicaEnabled sets the semi-sync replica enabled of MySQLD
func (*MySQLD) SetSemiSyncSourceEnabled ¶
SetSemiSyncSourceEnabled sets the semi-sync source enabled of MySQLD
type MySQLServer ¶
type MySQLServer struct { Version string `json:"version" config:"version"` HostIP string `json:"host_ip" config:"host_ip"` PortNum int `json:"port_num" config:"port_num"` RootPass string `json:"root_pass" config:"root_pass"` AdminUser string `json:"admin_user" config:"admin_user"` AdminPass string `json:"admin_pass" config:"admin_pass"` ClientUser string `json:"client_user" config:"client_user"` ClientPass string `json:"client_pass" config:"client_pass"` MySQLDMultiUser string `json:"mysqld_multi_user" config:"mysqld_multi_user"` MySQLDMultiPass string `json:"mysqld_multi_pass" config:"mysqld_multi_pass"` ReplicationUser string `json:"replication_user" config:"replication_user"` ReplicationPass string `json:"replication_pass" config:"replication_pass"` MonitorUser string `json:"monitor_user" config:"monitor_user"` MonitorPass string `json:"monitor_pass" config:"monitor_pass"` DASUser string `json:"das_user" config:"das_user"` DASPass string `json:"das_pass" config:"das_pass"` Title string `json:"title" config:"title"` BinaryDirBase string `json:"binary_dir_base" config:"binary_dir_base"` DataDirBaseName string `json:"data_dir_base_name" config:"data_dir_base_name"` DataDirBase string `json:"data_dir_base" config:"data_dir_base"` LogDirBaseName string `json:"log_dir_base_name" config:"log_dir_base_name"` LogDirBase string `json:"log_dir_base" config:"log_dir_base"` SemiSyncSourceEnabled int `json:"semi_sync_source_enabled" config:"semi_sync_source_enabled"` SemiSyncReplicaEnabled int `json:"semi_sync_replica_enabled" config:"semi_sync_replica_enabled"` SemiSyncSourceTimeout int `json:"semi_sync_source_timeout" config:"semi_sync_source_timeout"` GroupReplicationConsistency string `json:"group_replication_consistency" config:"group_replication_consistency"` GroupReplicationFlowControlMode string `json:"group_replication_flow_control_mode" config:"group_replication_flow_control_mode"` GroupReplicationMemberWeight int `json:"group_replication_member_weight" config:"group_replication_member_weight"` ServerID int `json:"server_id" config:"server_id"` BinlogExpireLogsSeconds int `json:"binlog_expire_logs_seconds" config:"binlog_expire_logs_seconds"` BinlogExpireLogsDays int `json:"binlog_expire_logs_days" config:"binlog_expire_logs_days"` BackupDir string `json:"backup_dir" config:"backup_dir"` MaxConnections int `json:"max_connections" config:"max_connections"` InnodbBufferPoolSize string `json:"innodb_buffer_pool_size" config:"innodb_buffer_pool_size"` InnodbIOCapacity int `json:"innodb_io_capacity" config:"innodb_io_capacity"` InnodbIOCapacityMax int `json:"innodb_io_capacity_max" config:"innodb_io_capacity_max"` }
func NewMySQLServer ¶
func NewMySQLServer(version, hostIP string, portNum int, rootPass, adminUser, adminPass, clientUser, clientPass, mysqldMultiUser, mysqldMultiPass, replicationUser, replicationPass, monitorUser, monitorPass, dasUser, dasPaas, title, binaryDirBase, dataDirBaseName, logDirBaseName string, semiSyncSourceEnabled, semiSyncReplicaEnabled, semiSyncSourceTimeout int, groupReplicationConsistency, groupReplicationFlowControlMode string, groupReplicationMemberWeight, serverID, binlogExpireLogsSeconds, binlogExpireLogsDays int, backupDir string, maxConnections int, innodbBufferPoolSize string, innodbIOCapacity int) *MySQLServer
NewMySQLServer returns a new *MySQLServer
func NewMySQLServerWithDefault ¶
func NewMySQLServerWithDefault() *MySQLServer
NewMySQLServerWithDefault returns a new *MySQLServer with default values
func (*MySQLServer) GetCommon ¶
func (ms *MySQLServer) GetCommon() *Common
GetCommon() gets the Common of MySQLServer
func (*MySQLServer) GetCommonConfig ¶
func (ms *MySQLServer) GetCommonConfig() ([]byte, error)
func (*MySQLServer) GetConfig ¶
func (ms *MySQLServer) GetConfig(v *version.Version, m mode.Mode) ([]byte, error)
GetConfig() gets the configuration of MySQLServer
func (*MySQLServer) GetConfigWithTitle ¶
func (ms *MySQLServer) GetConfigWithTitle(title string, v *version.Version, m mode.Mode) ([]byte, error)
GetConfigWithTitle gets the configuration of MySQLServer with given title
func (*MySQLServer) GetInitUserSQL ¶
func (ms *MySQLServer) GetInitUserSQL() (string, error)
GetInitUserSQL gets the SQL to initialize the user
func (*MySQLServer) GetMySQLD ¶
func (ms *MySQLServer) GetMySQLD() *MySQLD
GetMySQLD() gets the MySQLD of MySQLServer
func (*MySQLServer) GetMySQLDConfig ¶
func (ms *MySQLServer) GetMySQLDConfig(v *version.Version, m mode.Mode) ([]byte, error)
func (*MySQLServer) GetMySQLDConfigWithTitle ¶
func (ms *MySQLServer) GetMySQLDConfigWithTitle(title string, v *version.Version, m mode.Mode) ([]byte, error)
GetMySQLDConfigWithTitle gets the MySQLD configuration with given title
func (*MySQLServer) InitWithHostInfo ¶
func (ms *MySQLServer) InitWithHostInfo(hostIP string, portNum int, isSource bool) error
InitWithHostInfo initialize the MySQLServer with given host info
func (*MySQLServer) Marshal ¶
func (ms *MySQLServer) Marshal() ([]byte, error)
Marshal marshals the MySQLServer to json bytes
func (*MySQLServer) SetSemiSyncReplicaEnabled ¶
func (ms *MySQLServer) SetSemiSyncReplicaEnabled(semiSyncReplicaEnabled int)
SetSemiSyncReplicaEnabled sets the semi-sync replica enabled
func (*MySQLServer) SetSemiSyncSourceEnabled ¶
func (ms *MySQLServer) SetSemiSyncSourceEnabled(semiSyncSourceEnabled int)
SetSemiSyncSourceEnabled sets the semi-sync source enabled
func (*MySQLServer) SetVersion ¶
func (ms *MySQLServer) SetVersion(version string)
SetVersion sets the version, it also sets the binary dir base
func (*MySQLServer) Unmarshal ¶
func (ms *MySQLServer) Unmarshal(data []byte) error
Unmarshal unmarshals the json bytes to MySQLServer
func (*MySQLServer) WriteConfig ¶
func (ms *MySQLServer) WriteConfig(configPath string, data []byte) error
WriteConfig writes the configuration to the specified file
type PMMClient ¶
type PMMClient struct { ServerAddr string `json:"server_addr"` ServiceName string `json:"service_name"` ClientVersion string `json:"client_version"` ReplicationSetName string `json:"replication_set_name"` }
func NewPMMClient ¶
NewPMMClient returns a new *PMMClient
func NewPMMClientWithDefault ¶
func NewPMMClientWithDefault() *PMMClient
NewPMMClientWithDefault returns a new *PMMClient with default values
func (*PMMClient) SetReplicationSetName ¶
SetReplicationSetName sets replication set name
func (*PMMClient) SetServiceName ¶
SetServiceName sets service name