parameter

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: 14 Imported by: 0

Documentation

Index

Constants

View Source
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

func (*Common) GetConfig

func (c *Common) GetConfig() ([]byte, error)

GetConfig() gets the configuration of Common

func (*Common) Set

func (c *Common) Set(fields map[string]interface{}) error

Set sets Common with given fields, key is the field name and value is the relevant value of the key

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) GetConfig

func (md *MySQLD) GetConfig(v *version.Version, m mode.Mode) ([]byte, error)

GetConfig returns the configuration of MySQLD

func (*MySQLD) GetConfigWithTitle

func (md *MySQLD) GetConfigWithTitle(title string, v *version.Version, m mode.Mode) ([]byte, error)

GetConfigWithTitle returns the configuration of MySQLD with title

func (*MySQLD) SetSemiSyncReplicaEnabled

func (md *MySQLD) SetSemiSyncReplicaEnabled(semiSyncReplicaEnabled int)

SetSemiSyncReplicaEnabled sets the semi-sync replica enabled of MySQLD

func (*MySQLD) SetSemiSyncSourceEnabled

func (md *MySQLD) SetSemiSyncSourceEnabled(semiSyncSourceEnabled int)

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

func NewPMMClient(serverAddr, serviceName, clientVersion, replicationSetName string) *PMMClient

NewPMMClient returns a new *PMMClient

func NewPMMClientWithDefault

func NewPMMClientWithDefault() *PMMClient

NewPMMClientWithDefault returns a new *PMMClient with default values

func (*PMMClient) SetReplicationSetName

func (p *PMMClient) SetReplicationSetName(replicationSetName string)

SetReplicationSetName sets replication set name

func (*PMMClient) SetServiceName

func (p *PMMClient) SetServiceName(serviceName string)

SetServiceName sets service name

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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