config

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	ListenAddr string  `yaml:"listen_addr"`
	DataFile   string  `yaml:"data_file"`
	PluginDir  string  `yaml:"plugin_dir"`
	Health     Health  `yaml:"health"`
	Logging    Logging `yaml:"logging"`
}

type Config

type Config struct {
	App         AppConfig `yaml:"app"`
	Replication struct {
		// ServerID is the unique ID of the replica in MySQL cluster.
		// Omit this option if you'd like to auto generate ID.
		ServerID *uint32 `yaml:"server_id"`
		// GTIDMode indicates when to use GTID-based replication
		// or binlog file position.
		GTIDMode bool `yaml:"gtid_mode"`
		// SourceOpts is the options of leader.
		SourceOpts SourceConfig `yaml:"source"`
		// UpstreamOpts is the options of follower.
		UpstreamOpts UpstreamConfig `yaml:"upstream"`
		// Rules contains rules to handle data during the replication.
		Rules []RuleConfig `yaml:"rules"`
	} `yaml:"replication"`
}

func ReadFromFile

func ReadFromFile(path string) (*Config, error)

type Health

type Health struct {
	SecondsBehindMaster int `yaml:"seconds_behind_master"`
}

type Logging

type Logging struct {
	Level              string `yaml:"level"`
	SysLogEnabled      bool   `yaml:"syslog_enabled"`
	FileLoggingEnabled bool   `yaml:"file_enabled"`
	Filename           string `yaml:"file_name"`
	MaxSize            int    `yaml:"file_max_size"`    // megabytes
	MaxBackups         int    `yaml:"file_max_backups"` // files
	MaxAge             int    `yaml:"file_max_age"`     // days
}

type RuleConfig

type RuleConfig struct {
	Source struct {
		Table string `yaml:"table"`
	} `yaml:"source"`

	Upstream struct {
		Plugin struct {
			Name   string `yaml:"name"`
			Config string `yaml:"config"`
		} `yaml:"plugin"`
	} `yaml:"upstream"`
}

type SourceConfig

type SourceConfig struct {
	Dump struct {
		// ExtraOptions for mysqldump CLI.
		ExtraOptions []string `yaml:"extra_options"`
		// ExecPath is absolute path to mysqldump binary.
		ExecPath string `yaml:"exec_path"`
		// LoadInFileFlushThreshold defines a maximum number of rows to collect before flushing to the upstream database.
		LoadInFileFlushThreshold int `yaml:"load_in_file_flush_threshold"`
		// LoadInFileEnabled set true whether you want to dump the data using the LOAD DATA INFILE statement
		// instead of sending the transactions one by one.
		LoadInFileEnabled bool `yaml:"load_in_file_enabled"`
		// SkipMasterData set true if you have no privilege to use `--master-data`.
		SkipMasterData bool `yaml:"skip_master_data"`
	} `yaml:"dump"`
	Addr     string `yaml:"addr"`
	User     string `yaml:"user"`
	Password string `yaml:"password"`
	Database string `yaml:"database"`
	Charset  string `yaml:"charset"`
}

type UpstreamConfig

type UpstreamConfig struct {
	Addr           string        `yaml:"addr"`
	User           string        `yaml:"user"`
	Password       string        `yaml:"password"`
	Database       string        `yaml:"database"`
	Charset        string        `yaml:"charset"`
	MaxRetries     int           `yaml:"max_retries"`
	MaxOpenConns   int           `yaml:"max_open_conns"`
	MaxIdleConns   int           `yaml:"max_idle_conns"`
	ConnectTimeout time.Duration `yaml:"connect_timeout"`
	WriteTimeout   time.Duration `yaml:"write_timeout"`
}

Jump to

Keyboard shortcuts

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