util

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RcloneConfigFile represents the path to the file that contains rclon
	// configs. This path should be the same as defined in docker entrypoint
	// script from mysql-operator-sidecar/docker-entrypoint.sh. /etc/rclone.conf
	RcloneConfigFile = "/etc/rclone.conf"
)

Variables

View Source
var (
	// BackupPort is the port on which xtrabackup expose backups, 3306
	BackupPort = strconv.Itoa(constants.HelperXtrabackupPort)

	// MysqlPort represents port on which mysql works
	MysqlPort = strconv.Itoa(constants.MysqlPort)

	// ConfigDir is the mysql configs path, /etc/mysql
	ConfigDir = constants.ConfVolumeMountPath

	// ConfDPath is /etc/mysql/conf.d
	ConfDPath = constants.ConfDPath

	// MountConfigDir is the mounted configs that needs processing
	MountConfigDir = constants.ConfMapVolumeMountPath

	// DataDir is the mysql data. /var/lib/mysql
	DataDir = constants.DataVolumeMountPath

	// ToolsDbName is the name of the tools table
	ToolsDbName = constants.HelperDbName
	// ToolsInitTableName is the name of the init table
	ToolsInitTableName = "init"

	// UtilityUser is the name of the percona utility user.
	UtilityUser = "sys_utility_sidecar"

	// OrcTopologyDir contains the path where the secret with orc credentials is
	// mounted.
	OrcTopologyDir = constants.OrcTopologyDir

	// ServerPort http server port
	ServerPort = constants.HelperServerPort
	// ServerProbeEndpoint is the http server endpoint for probe
	ServerProbeEndpoint = constants.HelperServerProbePath
	// ServerBackupEndpoint is the http server endpoint for backups
	ServerBackupEndpoint = "/xbackup"
)

Functions

func CopyFile

func CopyFile(src, dst string) error

CopyFile the src file to dst. Any existing file will be overwritten and will not copy file attributes. nolint: gosec

func GetBackupPass

func GetBackupPass() string

GetBackupPass returns the basic auth credentials to access backup

func GetBackupUser

func GetBackupUser() string

GetBackupUser returns the basic auth credentials to access backup

func GetClusterName

func GetClusterName() string

GetClusterName returns the mysql cluster name from env MY_CLUSTER_NAME

func GetExporterPass

func GetExporterPass() string

GetExporterPass returns the replication password from env variable MYSQL_METRICS_EXPORTER_PASSWORD

func GetExporterUser

func GetExporterUser() string

GetExporterUser returns the replication user name from env variable MYSQL_METRICS_EXPORTER_USER

func GetHostFor

func GetHostFor(id int) string

GetHostFor returns the host for given server id

func GetHostname

func GetHostname() string

GetHostname returns the pod hostname from env HOSTNAME

func GetInitBucket

func GetInitBucket() string

GetInitBucket returns the bucket uri from env variable INIT_BUCKET_URI

func GetMasterHost

func GetMasterHost() string

GetMasterHost returns the master host

func GetMySQLConnectionString

func GetMySQLConnectionString() (string, error)

GetMySQLConnectionString returns the mysql DSN

func GetNamespace

func GetNamespace() string

GetNamespace returns the namespace of the pod from env MY_NAMESPACE

func GetOrcPass

func GetOrcPass() string

GetOrcPass returns the orchestrator topology password from env variable MYSQL_ORC_TOPOLOGY_PASSWORD

func GetOrcUser

func GetOrcUser() string

GetOrcUser returns the orchestrator topology user from env variable MYSQL_ORC_TOPOLOGY_USER

func GetReplPass

func GetReplPass() string

GetReplPass returns the replication password from env variable MYSQL_REPLICATION_PASSWORD

func GetReplUser

func GetReplUser() string

GetReplUser returns the replication user name from env variable MYSQL_REPLICATION_USER

func GetServerID

func GetServerID() int

GetServerID returns the mysql node ID

func GetServiceName

func GetServiceName() string

GetServiceName returns the headless service name from env MY_SERVICE_NAME

func MaxClients

func MaxClients(h http.Handler, n int) http.Handler

MaxClients limit an http endpoint to allow just n max concurrent connections

func NodeRole

func NodeRole() string

NodeRole returns the node mysql role: master or slave

func RequestABackup

func RequestABackup(host, endpoint string) (io.Reader, error)

RequestABackup connects to specified host and endpoint and gets the backup

func RunQuery

func RunQuery(q string, args ...interface{}) error

RunQuery executes a query

Types

This section is empty.

Jump to

Keyboard shortcuts

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