sidecar

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MysqlServerIDOffset represents the offset with which all server ids are shifted from 0
	MysqlServerIDOffset = 100
)

Functions

func RunCloneCommand

func RunCloneCommand(cfg *Config) error

RunCloneCommand clone the data from source. nolint: gocyclo

func RunConfigCommand

func RunConfigCommand(cfg *Config) error

RunConfigCommand generates my.cnf, client.cnf and 10-dynamic.cnf files.

func RunSidecarCommand

func RunSidecarCommand(cfg *Config, stop <-chan struct{}) error

RunSidecarCommand is the main command, and represents the runtime helper that configures the mysql server

func RunTakeBackupCommand

func RunTakeBackupCommand(cfg *Config, srcHost, destBucket string) error

RunTakeBackupCommand starts a backup command

Types

type Config

type Config struct {
	// Hostname represents the pod hostname
	Hostname string
	// ClusterName is the MySQL cluster name
	ClusterName string
	// Namespace represents the namespace where the pod is in
	Namespace string
	// ServiceName is the name of the headless service
	ServiceName string

	// InitBucketURL represents the init bucket to initialize mysql
	InitBucketURL string

	// OrchestratorURL is the URL to connect to orchestrator
	OrchestratorURL string

	// backup user and password for http endpoint
	BackupUser     string
	BackupPassword string

	// replication user and password
	ReplicationUser     string
	ReplicationPassword string

	// metrics exporter user and password
	MetricsUser     string
	MetricsPassword string

	// orchestrator credentials
	OrchestratorUser     string
	OrchestratorPassword string
}

Config contains information related with the pod.

func NewConfig

func NewConfig() *Config

NewConfig returns a pointer to Config configured from environment variables

func (*Config) ClusterFQDN

func (cfg *Config) ClusterFQDN() string

ClusterFQDN returns the cluster FQ Name of the cluster from which the node belongs

func (*Config) FQDNForServer

func (cfg *Config) FQDNForServer(id int) string

FQDNForServer returns the pod hostname for given MySQL server id

func (*Config) MasterFQDN

func (cfg *Config) MasterFQDN() string

MasterFQDN the FQ Name of the cluster's master

func (*Config) MysqlDSN

func (cfg *Config) MysqlDSN() string

MysqlDSN returns the connection string to MySQL server

func (*Config) NodeRole

func (cfg *Config) NodeRole() NodeRole

NodeRole returns the role of the current node

func (*Config) ServerID

func (cfg *Config) ServerID() int

ServerID returns the MySQL server id

type NodeRole

type NodeRole string

NodeRole represents the kind of the MySQL server

const (
	// MasterNode represents the master role for MySQL server
	MasterNode NodeRole = "master"
	// SlaveNode represents the slave role for MySQL server
	SlaveNode NodeRole = "slave"
)

Jump to

Keyboard shortcuts

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