spec

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2020 License: Apache-2.0 Imports: 37 Imported by: 11

Documentation

Index

Constants

View Source
const (
	ComponentTiDB             = "tidb"
	ComponentTiKV             = "tikv"
	ComponentPD               = "pd"
	ComponentTiFlash          = "tiflash"
	ComponentGrafana          = "grafana"
	ComponentDrainer          = "drainer"
	ComponentPump             = "pump"
	ComponentCDC              = "cdc"
	ComponentTiSpark          = "tispark"
	ComponentSpark            = "spark"
	ComponentAlertManager     = "alertmanager"
	ComponentPrometheus       = "prometheus"
	ComponentPushwaygate      = "pushgateway"
	ComponentBlackboxExporter = "blackbox_exporter"
	ComponentNodeExporter     = "node_exporter"
	ComponentCheckCollector   = "insight"
)

Components names supported by TiOps

View Source
const (
	TiOpsPackageCacheDir = "packages"
	TiOpsClusterDir      = "clusters"
	TiOpsAuditDir        = "audit"
)

sub directory names

View Source
const (
	// AnsibleImportedConfigPath is the sub path where all imported configs are stored
	AnsibleImportedConfigPath = "ansible-imported-configs"
	// TempConfigPath is the sub path where generated temporary configs are stored
	TempConfigPath = "config-cache"
)
View Source
const (

	// PatchDirName is the directory to store patch file eg. {PatchDirName}/tidb-hotfix.tar.gz
	PatchDirName = "patch"
	// BackupDirName is the directory to save backup files.
	BackupDirName = "backup"
)

Variables

View Source
var (
	RoleMonitor              = "monitor"
	RoleTiSparkMaster        = "tispark-master"
	RoleTiSparkWorker        = "tispark-worker"
	ErrNoTiSparkMaster       = errors.New("there must be a Spark master node if you want to use the TiSpark component")
	ErrMultipleTiSparkMaster = errors.New("a TiSpark enabled cluster with more than 1 Spark master node is not supported")
	ErrMultipleTisparkWorker = errors.New("multiple TiSpark workers on the same host is not supported by Spark")
)

general role names

View Source
var (

	// ErrCreateDirFailed is ErrCreateDirFailed
	ErrCreateDirFailed = errNS.NewType("create_dir_failed")
	// ErrSaveMetaFailed is ErrSaveMetaFailed
	ErrSaveMetaFailed = errNS.NewType("save_meta_failed")
)
View Source
var ErrorCheckConfig = errors.New("check config failed")

ErrorCheckConfig represent error occured in config check stage

Functions

func AllComponentNames

func AllComponentNames() (roles []string)

AllComponentNames contains the names of all components. should include all components in ComponentsByStartOrder

func AuditDir added in v1.0.9

func AuditDir() string

AuditDir return the directory for saving audit log.

func ClusterPath

func ClusterPath(cluster string, subpath ...string) string

ClusterPath returns the full path to a subpath (file or directory) of a cluster, it is a subdir in the profile dir of the user, with the cluster name as its name. It is not guaranteed the path already exist.

func ComponentSubDir added in v1.0.9

func ComponentSubDir(comp, version string) string

ComponentSubDir maps a component with version to a subdir if needed

func ComponentVersion

func ComponentVersion(comp, version string) string

ComponentVersion maps the TiDB version to the third components binding version

func HandleImportPathMigration

func HandleImportPathMigration(clsName string) error

HandleImportPathMigration tries to rename old configs file directory for imported clusters to the new name

func Initialize

func Initialize(base string) error

Initialize initializes the global variables of meta package. If the environment variable TIUP_COMPONENT_DATA_DIR is set, it is used as root of the profile directory, otherwise the `$HOME/.tiops` of current user is used. The directory will be created before return if it does not already exist.

func IterHost added in v1.0.9

func IterHost(topo Topology, fn func(instance Instance))

IterHost iterates one instance for each host

func Merge2Toml added in v1.0.8

func Merge2Toml(comp string, global, overwrite map[string]interface{}) ([]byte, error)

Merge2Toml merge the config of global.

func MergeResourceControl

func MergeResourceControl(lhs, rhs meta.ResourceControl) meta.ResourceControl

MergeResourceControl merge the rhs into lhs and overwrite rhs if lhs has value for same field

func PortStarted

func PortStarted(e executor.Executor, port int, timeout int64) error

PortStarted wait until a port is being listened

func PortStopped

func PortStopped(e executor.Executor, port int, timeout int64) error

PortStopped wait until a port is being released

func ProfileDir

func ProfileDir() string

ProfileDir returns the full profile directory path of TiOps.

func ProfilePath

func ProfilePath(subpath ...string) string

ProfilePath joins a path under the profile dir

func SaveClusterMeta

func SaveClusterMeta(clusterName string, cmeta *ClusterMeta) error

SaveClusterMeta saves the cluster meta information to profile directory

Types

type AlertManagerComponent

type AlertManagerComponent struct{ *Specification }

AlertManagerComponent represents Alertmanager component.

func (*AlertManagerComponent) Instances

func (c *AlertManagerComponent) Instances() []Instance

Instances implements Component interface.

func (*AlertManagerComponent) Name

func (c *AlertManagerComponent) Name() string

Name implements Component interface.

type AlertManagerInstance

type AlertManagerInstance struct {
	// contains filtered or unexported fields
}

AlertManagerInstance represent the alert manager instance

func (*AlertManagerInstance) Arch

func (i *AlertManagerInstance) Arch() string

func (*AlertManagerInstance) ComponentName

func (i *AlertManagerInstance) ComponentName() string

ComponentName implements Instance interface

func (*AlertManagerInstance) DataDir

func (i *AlertManagerInstance) DataDir() string

func (*AlertManagerInstance) DeployDir

func (i *AlertManagerInstance) DeployDir() string

func (*AlertManagerInstance) GetHost

func (i *AlertManagerInstance) GetHost() string

GetHost implements Instance interface

func (*AlertManagerInstance) GetListenHost

func (i *AlertManagerInstance) GetListenHost() string

GetListenHost implements Instance interface

func (*AlertManagerInstance) GetPort

func (i *AlertManagerInstance) GetPort() int

func (*AlertManagerInstance) GetSSHPort

func (i *AlertManagerInstance) GetSSHPort() int

GetSSHPort implements Instance interface

func (*AlertManagerInstance) ID

func (i *AlertManagerInstance) ID() string

ID returns the identifier of this instance, the ID is constructed by host:port

func (*AlertManagerInstance) InitConfig

func (i *AlertManagerInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error

InitConfig implement Instance interface

func (*AlertManagerInstance) InstanceName

func (i *AlertManagerInstance) InstanceName() string

InstanceName implements Instance interface

func (*AlertManagerInstance) LogDir

func (i *AlertManagerInstance) LogDir() string

func (*AlertManagerInstance) OS

func (i *AlertManagerInstance) OS() string

func (*AlertManagerInstance) PrepareStart

func (i *AlertManagerInstance) PrepareStart() error

PrepareStart checks instance requirements before starting

func (*AlertManagerInstance) Ready

func (i *AlertManagerInstance) Ready(e executor.Executor, timeout int64) error

Ready implements Instance interface

func (*AlertManagerInstance) ScaleConfig

func (i *AlertManagerInstance) ScaleConfig(e executor.Executor, topo Topology,
	clusterName string, clusterVersion string, deployUser string, paths meta.DirPaths) error

ScaleConfig deploy temporary config on scaling

func (*AlertManagerInstance) ServiceName

func (i *AlertManagerInstance) ServiceName() string

ServiceName implements Instance interface

func (*AlertManagerInstance) Status

func (i *AlertManagerInstance) Status(pdList ...string) string

func (*AlertManagerInstance) UsedDirs

func (i *AlertManagerInstance) UsedDirs() []string

func (*AlertManagerInstance) UsedPorts

func (i *AlertManagerInstance) UsedPorts() []int

func (*AlertManagerInstance) WaitForDown

func (i *AlertManagerInstance) WaitForDown(e executor.Executor, timeout int64) error

WaitForDown implements Instance interface

type AlertManagerSpec

type AlertManagerSpec struct {
	Host            string               `yaml:"host"`
	SSHPort         int                  `yaml:"ssh_port,omitempty" validate:"ssh_port:editable"`
	Imported        bool                 `yaml:"imported,omitempty"`
	WebPort         int                  `yaml:"web_port" default:"9093"`
	ClusterPort     int                  `yaml:"cluster_port" default:"9094"`
	DeployDir       string               `yaml:"deploy_dir,omitempty"`
	DataDir         string               `yaml:"data_dir,omitempty"`
	LogDir          string               `yaml:"log_dir,omitempty"`
	NumaNode        string               `yaml:"numa_node,omitempty" validate:"numa_node:editable"`
	ResourceControl meta.ResourceControl `yaml:"resource_control,omitempty" validate:"resource_control:editable"`
	Arch            string               `yaml:"arch,omitempty"`
	OS              string               `yaml:"os,omitempty"`
}

AlertManagerSpec represents the AlertManager topology specification in topology.yaml

func (AlertManagerSpec) GetMainPort

func (s AlertManagerSpec) GetMainPort() int

GetMainPort returns the main port of the instance

func (AlertManagerSpec) IsImported

func (s AlertManagerSpec) IsImported() bool

IsImported returns if the node is imported from TiDB-Ansible

func (AlertManagerSpec) Role

func (s AlertManagerSpec) Role() string

Role returns the component role of the instance

func (AlertManagerSpec) SSH

func (s AlertManagerSpec) SSH() (string, int)

SSH returns the host and SSH port of the instance

type BaseMeta added in v1.0.9

type BaseMeta struct {
	User    string
	Version string
	OpsVer  *string `yaml:"last_ops_ver,omitempty"` // the version of ourself that updated the meta last time
}

BaseMeta is the base info of metadata.

type BaseTopo added in v1.0.9

type BaseTopo struct {
	GlobalOptions    *GlobalOptions
	MonitoredOptions *MonitoredOptions
	MasterList       []string
}

BaseTopo is the base info to topology.

type CDCComponent

type CDCComponent struct{ *Specification }

CDCComponent represents CDC component.

func (*CDCComponent) Instances

func (c *CDCComponent) Instances() []Instance

Instances implements Component interface.

func (*CDCComponent) Name

func (c *CDCComponent) Name() string

Name implements Component interface.

type CDCInstance

type CDCInstance struct {
	// contains filtered or unexported fields
}

CDCInstance represent the CDC instance.

func (*CDCInstance) Arch

func (i *CDCInstance) Arch() string

func (*CDCInstance) ComponentName

func (i *CDCInstance) ComponentName() string

ComponentName implements Instance interface

func (*CDCInstance) DataDir

func (i *CDCInstance) DataDir() string

func (*CDCInstance) DeployDir

func (i *CDCInstance) DeployDir() string

func (*CDCInstance) GetHost

func (i *CDCInstance) GetHost() string

GetHost implements Instance interface

func (*CDCInstance) GetListenHost

func (i *CDCInstance) GetListenHost() string

GetListenHost implements Instance interface

func (*CDCInstance) GetPort

func (i *CDCInstance) GetPort() int

func (*CDCInstance) GetSSHPort

func (i *CDCInstance) GetSSHPort() int

GetSSHPort implements Instance interface

func (*CDCInstance) ID

func (i *CDCInstance) ID() string

ID returns the identifier of this instance, the ID is constructed by host:port

func (*CDCInstance) InitConfig

func (i *CDCInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error

InitConfig implements Instance interface.

func (*CDCInstance) InstanceName

func (i *CDCInstance) InstanceName() string

InstanceName implements Instance interface

func (*CDCInstance) LogDir

func (i *CDCInstance) LogDir() string

func (*CDCInstance) OS

func (i *CDCInstance) OS() string

func (*CDCInstance) PrepareStart

func (i *CDCInstance) PrepareStart() error

PrepareStart checks instance requirements before starting

func (*CDCInstance) Ready

func (i *CDCInstance) Ready(e executor.Executor, timeout int64) error

Ready implements Instance interface

func (*CDCInstance) ScaleConfig

func (i *CDCInstance) ScaleConfig(e executor.Executor, topo Topology, clusterName, clusterVersion, user string, paths meta.DirPaths) error

ScaleConfig deploy temporary config on scaling

func (*CDCInstance) ServiceName

func (i *CDCInstance) ServiceName() string

ServiceName implements Instance interface

func (*CDCInstance) Status

func (i *CDCInstance) Status(pdList ...string) string

func (*CDCInstance) UsedDirs

func (i *CDCInstance) UsedDirs() []string

func (*CDCInstance) UsedPorts

func (i *CDCInstance) UsedPorts() []int

func (*CDCInstance) WaitForDown

func (i *CDCInstance) WaitForDown(e executor.Executor, timeout int64) error

WaitForDown implements Instance interface

type CDCSpec

type CDCSpec struct {
	Host            string                 `yaml:"host"`
	SSHPort         int                    `yaml:"ssh_port,omitempty" validate:"ssh_port:editable"`
	Imported        bool                   `yaml:"imported,omitempty"`
	Port            int                    `yaml:"port" default:"8300"`
	DeployDir       string                 `yaml:"deploy_dir,omitempty"`
	LogDir          string                 `yaml:"log_dir,omitempty"`
	Offline         bool                   `yaml:"offline,omitempty"`
	NumaNode        string                 `yaml:"numa_node,omitempty" validate:"numa_node:editable"`
	Config          map[string]interface{} `yaml:"config,omitempty" validate:"config:ignore"`
	ResourceControl meta.ResourceControl   `yaml:"resource_control,omitempty" validate:"resource_control:editable"`
	Arch            string                 `yaml:"arch,omitempty"`
	OS              string                 `yaml:"os,omitempty"`
}

CDCSpec represents the Drainer topology specification in topology.yaml

func (CDCSpec) GetMainPort

func (s CDCSpec) GetMainPort() int

GetMainPort returns the main port of the instance

func (CDCSpec) IsImported

func (s CDCSpec) IsImported() bool

IsImported returns if the node is imported from TiDB-Ansible

func (CDCSpec) Role

func (s CDCSpec) Role() string

Role returns the component role of the instance

func (CDCSpec) SSH

func (s CDCSpec) SSH() (string, int)

SSH returns the host and SSH port of the instance

type ClusterMeta

type ClusterMeta struct {
	User    string `yaml:"user"`         // the user to run and manage cluster on remote
	Version string `yaml:"tidb_version"` // the version of TiDB cluster
	//EnableTLS      bool   `yaml:"enable_tls"`
	//EnableFirewall bool   `yaml:"firewall"`
	OpsVer string `yaml:"last_ops_ver,omitempty"` // the version of ourself that updated the meta last time

	Topology *Specification `yaml:"topology"`
}

ClusterMeta is the specification of generic cluster metadata

func ClusterMetadata

func ClusterMetadata(clusterName string) (*ClusterMeta, error)

ClusterMetadata tries to read the metadata of a cluster from file

func (*ClusterMeta) GetBaseMeta added in v1.0.9

func (m *ClusterMeta) GetBaseMeta() *BaseMeta

GetBaseMeta implements Metadata interface.

func (*ClusterMeta) GetTopology added in v1.0.9

func (m *ClusterMeta) GetTopology() Topology

GetTopology implement Metadata interface.

func (*ClusterMeta) SetTopology added in v1.0.9

func (m *ClusterMeta) SetTopology(topo Topology)

SetTopology implement Metadata interface.

func (*ClusterMeta) SetUser added in v1.0.9

func (m *ClusterMeta) SetUser(s string)

SetUser implement UpgradableMetadata interface.

func (*ClusterMeta) SetVersion added in v1.0.9

func (m *ClusterMeta) SetVersion(s string)

SetVersion implement UpgradableMetadata interface.

type Component

type Component interface {
	Name() string
	Instances() []Instance
}

Component represents a component of the cluster.

type DrainerComponent

type DrainerComponent struct{ *Specification }

DrainerComponent represents Drainer component.

func (*DrainerComponent) Instances

func (c *DrainerComponent) Instances() []Instance

Instances implements Component interface.

func (*DrainerComponent) Name

func (c *DrainerComponent) Name() string

Name implements Component interface.

type DrainerInstance

type DrainerInstance struct {
	// contains filtered or unexported fields
}

DrainerInstance represent the Drainer instance.

func (*DrainerInstance) Arch

func (i *DrainerInstance) Arch() string

func (*DrainerInstance) ComponentName

func (i *DrainerInstance) ComponentName() string

ComponentName implements Instance interface

func (*DrainerInstance) DataDir

func (i *DrainerInstance) DataDir() string

func (*DrainerInstance) DeployDir

func (i *DrainerInstance) DeployDir() string

func (*DrainerInstance) GetHost

func (i *DrainerInstance) GetHost() string

GetHost implements Instance interface

func (*DrainerInstance) GetListenHost

func (i *DrainerInstance) GetListenHost() string

GetListenHost implements Instance interface

func (*DrainerInstance) GetPort

func (i *DrainerInstance) GetPort() int

func (*DrainerInstance) GetSSHPort

func (i *DrainerInstance) GetSSHPort() int

GetSSHPort implements Instance interface

func (*DrainerInstance) ID

func (i *DrainerInstance) ID() string

ID returns the identifier of this instance, the ID is constructed by host:port

func (*DrainerInstance) InitConfig

func (i *DrainerInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error

InitConfig implements Instance interface.

func (*DrainerInstance) InstanceName

func (i *DrainerInstance) InstanceName() string

InstanceName implements Instance interface

func (*DrainerInstance) LogDir

func (i *DrainerInstance) LogDir() string

func (*DrainerInstance) OS

func (i *DrainerInstance) OS() string

func (*DrainerInstance) PrepareStart

func (i *DrainerInstance) PrepareStart() error

PrepareStart checks instance requirements before starting

func (*DrainerInstance) Ready

func (i *DrainerInstance) Ready(e executor.Executor, timeout int64) error

Ready implements Instance interface

func (*DrainerInstance) ScaleConfig

func (i *DrainerInstance) ScaleConfig(e executor.Executor, topo Topology, clusterName, clusterVersion, user string, paths meta.DirPaths) error

ScaleConfig deploy temporary config on scaling

func (*DrainerInstance) ServiceName

func (i *DrainerInstance) ServiceName() string

ServiceName implements Instance interface

func (*DrainerInstance) Status

func (i *DrainerInstance) Status(pdList ...string) string

func (*DrainerInstance) UsedDirs

func (i *DrainerInstance) UsedDirs() []string

func (*DrainerInstance) UsedPorts

func (i *DrainerInstance) UsedPorts() []int

func (*DrainerInstance) WaitForDown

func (i *DrainerInstance) WaitForDown(e executor.Executor, timeout int64) error

WaitForDown implements Instance interface

type DrainerSpec

type DrainerSpec struct {
	Host            string                 `yaml:"host"`
	SSHPort         int                    `yaml:"ssh_port,omitempty" validate:"ssh_port:editable"`
	Imported        bool                   `yaml:"imported,omitempty"`
	Port            int                    `yaml:"port" default:"8249"`
	DeployDir       string                 `yaml:"deploy_dir,omitempty"`
	DataDir         string                 `yaml:"data_dir,omitempty"`
	LogDir          string                 `yaml:"log_dir,omitempty"`
	CommitTS        int64                  `yaml:"commit_ts,omitempty"`
	Offline         bool                   `yaml:"offline,omitempty"`
	NumaNode        string                 `yaml:"numa_node,omitempty" validate:"numa_node:editable"`
	Config          map[string]interface{} `yaml:"config,omitempty" validate:"config:ignore"`
	ResourceControl meta.ResourceControl   `yaml:"resource_control,omitempty" validate:"resource_control:editable"`
	Arch            string                 `yaml:"arch,omitempty"`
	OS              string                 `yaml:"os,omitempty"`
}

DrainerSpec represents the Drainer topology specification in topology.yaml

func (DrainerSpec) GetMainPort

func (s DrainerSpec) GetMainPort() int

GetMainPort returns the main port of the instance

func (DrainerSpec) IsImported

func (s DrainerSpec) IsImported() bool

IsImported returns if the node is imported from TiDB-Ansible

func (DrainerSpec) Role

func (s DrainerSpec) Role() string

Role returns the component role of the instance

func (DrainerSpec) SSH

func (s DrainerSpec) SSH() (string, int)

SSH returns the host and SSH port of the instance

type GlobalOptions

type GlobalOptions struct {
	User            string               `yaml:"user,omitempty" default:"tidb"`
	SSHPort         int                  `yaml:"ssh_port,omitempty" default:"22" validate:"ssh_port:editable"`
	DeployDir       string               `yaml:"deploy_dir,omitempty" default:"deploy"`
	DataDir         string               `yaml:"data_dir,omitempty" default:"data"`
	LogDir          string               `yaml:"log_dir,omitempty"`
	ResourceControl meta.ResourceControl `yaml:"resource_control,omitempty" validate:"resource_control:editable"`
	OS              string               `yaml:"os,omitempty" default:"linux"`
	Arch            string               `yaml:"arch,omitempty" default:"amd64"`
}

GlobalOptions represents the global options for all groups in topology specification in topology.yaml

type GrafanaComponent

type GrafanaComponent struct{ *Specification }

GrafanaComponent represents Grafana component.

func (*GrafanaComponent) Instances

func (c *GrafanaComponent) Instances() []Instance

Instances implements Component interface.

func (*GrafanaComponent) Name

func (c *GrafanaComponent) Name() string

Name implements Component interface.

type GrafanaInstance

type GrafanaInstance struct {
	// contains filtered or unexported fields
}

GrafanaInstance represent the grafana instance

func (*GrafanaInstance) Arch

func (i *GrafanaInstance) Arch() string

func (*GrafanaInstance) ComponentName

func (i *GrafanaInstance) ComponentName() string

ComponentName implements Instance interface

func (*GrafanaInstance) DataDir

func (i *GrafanaInstance) DataDir() string

func (*GrafanaInstance) DeployDir

func (i *GrafanaInstance) DeployDir() string

func (*GrafanaInstance) GetHost

func (i *GrafanaInstance) GetHost() string

GetHost implements Instance interface

func (*GrafanaInstance) GetListenHost

func (i *GrafanaInstance) GetListenHost() string

GetListenHost implements Instance interface

func (*GrafanaInstance) GetPort

func (i *GrafanaInstance) GetPort() int

func (*GrafanaInstance) GetSSHPort

func (i *GrafanaInstance) GetSSHPort() int

GetSSHPort implements Instance interface

func (*GrafanaInstance) ID

func (i *GrafanaInstance) ID() string

ID returns the identifier of this instance, the ID is constructed by host:port

func (*GrafanaInstance) InitConfig

func (i *GrafanaInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error

InitConfig implement Instance interface

func (*GrafanaInstance) InstanceName

func (i *GrafanaInstance) InstanceName() string

InstanceName implements Instance interface

func (*GrafanaInstance) LogDir

func (i *GrafanaInstance) LogDir() string

func (*GrafanaInstance) OS

func (i *GrafanaInstance) OS() string

func (*GrafanaInstance) PrepareStart

func (i *GrafanaInstance) PrepareStart() error

PrepareStart checks instance requirements before starting

func (*GrafanaInstance) Ready

func (i *GrafanaInstance) Ready(e executor.Executor, timeout int64) error

Ready implements Instance interface

func (*GrafanaInstance) ScaleConfig

func (i *GrafanaInstance) ScaleConfig(e executor.Executor, topo Topology,
	clusterName string, clusterVersion string, deployUser string, paths meta.DirPaths) error

ScaleConfig deploy temporary config on scaling

func (*GrafanaInstance) ServiceName

func (i *GrafanaInstance) ServiceName() string

ServiceName implements Instance interface

func (*GrafanaInstance) Status

func (i *GrafanaInstance) Status(pdList ...string) string

func (*GrafanaInstance) UsedDirs

func (i *GrafanaInstance) UsedDirs() []string

func (*GrafanaInstance) UsedPorts

func (i *GrafanaInstance) UsedPorts() []int

func (*GrafanaInstance) WaitForDown

func (i *GrafanaInstance) WaitForDown(e executor.Executor, timeout int64) error

WaitForDown implements Instance interface

type GrafanaSpec

type GrafanaSpec struct {
	Host            string               `yaml:"host"`
	SSHPort         int                  `yaml:"ssh_port,omitempty" validate:"ssh_port:editable"`
	Imported        bool                 `yaml:"imported,omitempty"`
	Port            int                  `yaml:"port" default:"3000"`
	DeployDir       string               `yaml:"deploy_dir,omitempty"`
	ResourceControl meta.ResourceControl `yaml:"resource_control,omitempty" validate:"resource_control:editable"`
	Arch            string               `yaml:"arch,omitempty"`
	OS              string               `yaml:"os,omitempty"`
}

GrafanaSpec represents the Grafana topology specification in topology.yaml

func (GrafanaSpec) GetMainPort

func (s GrafanaSpec) GetMainPort() int

GetMainPort returns the main port of the instance

func (GrafanaSpec) IsImported

func (s GrafanaSpec) IsImported() bool

IsImported returns if the node is imported from TiDB-Ansible

func (GrafanaSpec) Role

func (s GrafanaSpec) Role() string

Role returns the component role of the instance

func (GrafanaSpec) SSH

func (s GrafanaSpec) SSH() (string, int)

SSH returns the host and SSH port of the instance

type Instance

type Instance interface {
	InstanceSpec
	ID() string
	Ready(executor.Executor, int64) error
	WaitForDown(executor.Executor, int64) error
	InitConfig(e executor.Executor, clusterName string, clusterVersion string, deployUser string, paths meta.DirPaths) error
	ScaleConfig(e executor.Executor, topo Topology, clusterName string, clusterVersion string, deployUser string, paths meta.DirPaths) error
	PrepareStart() error
	ComponentName() string
	InstanceName() string
	ServiceName() string
	GetHost() string
	GetPort() int
	GetSSHPort() int
	DeployDir() string
	UsedPorts() []int
	UsedDirs() []string
	Status(pdList ...string) string
	DataDir() string
	LogDir() string
	OS() string // only linux supported now
	Arch() string
}

Instance represents the instance.

type InstanceSpec

type InstanceSpec interface {
	Role() string
	SSH() (string, int)
	GetMainPort() int
	IsImported() bool
}

InstanceSpec represent a instance specification

type Metadata added in v1.0.9

type Metadata interface {
	GetTopology() Topology
	SetTopology(topo Topology)
	GetBaseMeta() *BaseMeta

	UpgradableMetadata
}

Metadata of a cluster.

type MonitorComponent

type MonitorComponent struct{ *Specification }

MonitorComponent represents Monitor component.

func (*MonitorComponent) Instances

func (c *MonitorComponent) Instances() []Instance

Instances implements Component interface.

func (*MonitorComponent) Name

func (c *MonitorComponent) Name() string

Name implements Component interface.

type MonitorInstance

type MonitorInstance struct {
	// contains filtered or unexported fields
}

MonitorInstance represent the monitor instance

func (*MonitorInstance) Arch

func (i *MonitorInstance) Arch() string

func (*MonitorInstance) ComponentName

func (i *MonitorInstance) ComponentName() string

ComponentName implements Instance interface

func (*MonitorInstance) DataDir

func (i *MonitorInstance) DataDir() string

func (*MonitorInstance) DeployDir

func (i *MonitorInstance) DeployDir() string

func (*MonitorInstance) GetHost

func (i *MonitorInstance) GetHost() string

GetHost implements Instance interface

func (*MonitorInstance) GetListenHost

func (i *MonitorInstance) GetListenHost() string

GetListenHost implements Instance interface

func (*MonitorInstance) GetPort

func (i *MonitorInstance) GetPort() int

func (*MonitorInstance) GetSSHPort

func (i *MonitorInstance) GetSSHPort() int

GetSSHPort implements Instance interface

func (*MonitorInstance) ID

func (i *MonitorInstance) ID() string

ID returns the identifier of this instance, the ID is constructed by host:port

func (*MonitorInstance) InitConfig

func (i *MonitorInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error

InitConfig implement Instance interface

func (*MonitorInstance) InstanceName

func (i *MonitorInstance) InstanceName() string

InstanceName implements Instance interface

func (*MonitorInstance) LogDir

func (i *MonitorInstance) LogDir() string

func (*MonitorInstance) OS

func (i *MonitorInstance) OS() string

func (*MonitorInstance) PrepareStart

func (i *MonitorInstance) PrepareStart() error

PrepareStart checks instance requirements before starting

func (*MonitorInstance) Ready

func (i *MonitorInstance) Ready(e executor.Executor, timeout int64) error

Ready implements Instance interface

func (*MonitorInstance) ScaleConfig

func (i *MonitorInstance) ScaleConfig(e executor.Executor, topo Topology,
	clusterName string, clusterVersion string, deployUser string, paths meta.DirPaths) error

ScaleConfig deploy temporary config on scaling

func (*MonitorInstance) ServiceName

func (i *MonitorInstance) ServiceName() string

ServiceName implements Instance interface

func (*MonitorInstance) Status

func (i *MonitorInstance) Status(pdList ...string) string

func (*MonitorInstance) UsedDirs

func (i *MonitorInstance) UsedDirs() []string

func (*MonitorInstance) UsedPorts

func (i *MonitorInstance) UsedPorts() []int

func (*MonitorInstance) WaitForDown

func (i *MonitorInstance) WaitForDown(e executor.Executor, timeout int64) error

WaitForDown implements Instance interface

type MonitoredOptions

type MonitoredOptions struct {
	NodeExporterPort     int                  `yaml:"node_exporter_port,omitempty" default:"9100"`
	BlackboxExporterPort int                  `yaml:"blackbox_exporter_port,omitempty" default:"9115"`
	DeployDir            string               `yaml:"deploy_dir,omitempty"`
	DataDir              string               `yaml:"data_dir,omitempty"`
	LogDir               string               `yaml:"log_dir,omitempty"`
	NumaNode             string               `yaml:"numa_node,omitempty" validate:"numa_node:editable"`
	ResourceControl      meta.ResourceControl `yaml:"resource_control,omitempty" validate:"resource_control:editable"`
}

MonitoredOptions represents the monitored node configuration

type PDComponent

type PDComponent struct{ *Specification }

PDComponent represents PD component.

func (*PDComponent) Instances

func (c *PDComponent) Instances() []Instance

Instances implements Component interface.

func (*PDComponent) Name

func (c *PDComponent) Name() string

Name implements Component interface.

type PDInstance

type PDInstance struct {
	Name string
	// contains filtered or unexported fields
}

PDInstance represent the PD instance

func (*PDInstance) Arch

func (i *PDInstance) Arch() string

func (*PDInstance) ComponentName

func (i *PDInstance) ComponentName() string

ComponentName implements Instance interface

func (*PDInstance) DataDir

func (i *PDInstance) DataDir() string

func (*PDInstance) DeployDir

func (i *PDInstance) DeployDir() string

func (*PDInstance) GetHost

func (i *PDInstance) GetHost() string

GetHost implements Instance interface

func (*PDInstance) GetListenHost

func (i *PDInstance) GetListenHost() string

GetListenHost implements Instance interface

func (*PDInstance) GetPort

func (i *PDInstance) GetPort() int

func (*PDInstance) GetSSHPort

func (i *PDInstance) GetSSHPort() int

GetSSHPort implements Instance interface

func (*PDInstance) ID

func (i *PDInstance) ID() string

ID returns the identifier of this instance, the ID is constructed by host:port

func (*PDInstance) InitConfig

func (i *PDInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error

InitConfig implement Instance interface

func (*PDInstance) InstanceName

func (i *PDInstance) InstanceName() string

InstanceName implements Instance interface

func (*PDInstance) LogDir

func (i *PDInstance) LogDir() string

func (*PDInstance) OS

func (i *PDInstance) OS() string

func (*PDInstance) PostRestart added in v1.0.9

func (i *PDInstance) PostRestart(topo Topology) error

PostRestart implements RollingUpdateInstance interface.

func (*PDInstance) PreRestart added in v1.0.9

func (i *PDInstance) PreRestart(topo Topology, apiTimeoutSeconds int) error

PreRestart implements RollingUpdateInstance interface.

func (*PDInstance) PrepareStart

func (i *PDInstance) PrepareStart() error

PrepareStart checks instance requirements before starting

func (*PDInstance) Ready

func (i *PDInstance) Ready(e executor.Executor, timeout int64) error

Ready implements Instance interface

func (*PDInstance) ScaleConfig

func (i *PDInstance) ScaleConfig(e executor.Executor, topo Topology, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error

ScaleConfig deploy temporary config on scaling

func (*PDInstance) ServiceName

func (i *PDInstance) ServiceName() string

ServiceName implements Instance interface

func (*PDInstance) Status

func (i *PDInstance) Status(pdList ...string) string

func (*PDInstance) UsedDirs

func (i *PDInstance) UsedDirs() []string

func (*PDInstance) UsedPorts

func (i *PDInstance) UsedPorts() []int

func (*PDInstance) WaitForDown

func (i *PDInstance) WaitForDown(e executor.Executor, timeout int64) error

WaitForDown implements Instance interface

type PDSpec

type PDSpec struct {
	Host       string `yaml:"host"`
	ListenHost string `yaml:"listen_host,omitempty"`
	SSHPort    int    `yaml:"ssh_port,omitempty" validate:"ssh_port:editable"`
	Imported   bool   `yaml:"imported,omitempty"`
	// Use Name to get the name with a default value if it's empty.
	Name            string                 `yaml:"name"`
	ClientPort      int                    `yaml:"client_port" default:"2379"`
	PeerPort        int                    `yaml:"peer_port" default:"2380"`
	DeployDir       string                 `yaml:"deploy_dir,omitempty"`
	DataDir         string                 `yaml:"data_dir,omitempty"`
	LogDir          string                 `yaml:"log_dir,omitempty"`
	NumaNode        string                 `yaml:"numa_node,omitempty" validate:"numa_node:editable"`
	Config          map[string]interface{} `yaml:"config,omitempty" validate:"config:ignore"`
	ResourceControl meta.ResourceControl   `yaml:"resource_control,omitempty" validate:"resource_control:editable"`
	Arch            string                 `yaml:"arch,omitempty"`
	OS              string                 `yaml:"os,omitempty"`
}

PDSpec represents the PD topology specification in topology.yaml

func (PDSpec) GetMainPort

func (s PDSpec) GetMainPort() int

GetMainPort returns the main port of the instance

func (PDSpec) IsImported

func (s PDSpec) IsImported() bool

IsImported returns if the node is imported from TiDB-Ansible

func (PDSpec) Role

func (s PDSpec) Role() string

Role returns the component role of the instance

func (PDSpec) SSH

func (s PDSpec) SSH() (string, int)

SSH returns the host and SSH port of the instance

func (PDSpec) Status

func (s PDSpec) Status(pdList ...string) string

Status queries current status of the instance

type PrometheusSpec

type PrometheusSpec struct {
	Host            string               `yaml:"host"`
	SSHPort         int                  `yaml:"ssh_port,omitempty" validate:"ssh_port:editable"`
	Imported        bool                 `yaml:"imported,omitempty"`
	Port            int                  `yaml:"port" default:"9090"`
	DeployDir       string               `yaml:"deploy_dir,omitempty"`
	DataDir         string               `yaml:"data_dir,omitempty"`
	LogDir          string               `yaml:"log_dir,omitempty"`
	NumaNode        string               `yaml:"numa_node,omitempty" validate:"numa_node:editable"`
	Retention       string               `yaml:"storage_retention,omitempty" validate:"storage_retention:editable"`
	ResourceControl meta.ResourceControl `yaml:"resource_control,omitempty" validate:"resource_control:editable"`
	Arch            string               `yaml:"arch,omitempty"`
	OS              string               `yaml:"os,omitempty"`
}

PrometheusSpec represents the Prometheus Server topology specification in topology.yaml

func (PrometheusSpec) GetMainPort

func (s PrometheusSpec) GetMainPort() int

GetMainPort returns the main port of the instance

func (PrometheusSpec) IsImported

func (s PrometheusSpec) IsImported() bool

IsImported returns if the node is imported from TiDB-Ansible

func (PrometheusSpec) Role

func (s PrometheusSpec) Role() string

Role returns the component role of the instance

func (PrometheusSpec) SSH

func (s PrometheusSpec) SSH() (string, int)

SSH returns the host and SSH port of the instance

type PumpComponent

type PumpComponent struct{ *Specification }

PumpComponent represents Pump component.

func (*PumpComponent) Instances

func (c *PumpComponent) Instances() []Instance

Instances implements Component interface.

func (*PumpComponent) Name

func (c *PumpComponent) Name() string

Name implements Component interface.

type PumpInstance

type PumpInstance struct {
	// contains filtered or unexported fields
}

PumpInstance represent the Pump instance.

func (*PumpInstance) Arch

func (i *PumpInstance) Arch() string

func (*PumpInstance) ComponentName

func (i *PumpInstance) ComponentName() string

ComponentName implements Instance interface

func (*PumpInstance) DataDir

func (i *PumpInstance) DataDir() string

func (*PumpInstance) DeployDir

func (i *PumpInstance) DeployDir() string

func (*PumpInstance) GetHost

func (i *PumpInstance) GetHost() string

GetHost implements Instance interface

func (*PumpInstance) GetListenHost

func (i *PumpInstance) GetListenHost() string

GetListenHost implements Instance interface

func (*PumpInstance) GetPort

func (i *PumpInstance) GetPort() int

func (*PumpInstance) GetSSHPort

func (i *PumpInstance) GetSSHPort() int

GetSSHPort implements Instance interface

func (*PumpInstance) ID

func (i *PumpInstance) ID() string

ID returns the identifier of this instance, the ID is constructed by host:port

func (*PumpInstance) InitConfig

func (i *PumpInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error

InitConfig implements Instance interface.

func (*PumpInstance) InstanceName

func (i *PumpInstance) InstanceName() string

InstanceName implements Instance interface

func (*PumpInstance) LogDir

func (i *PumpInstance) LogDir() string

func (*PumpInstance) OS

func (i *PumpInstance) OS() string

func (*PumpInstance) PrepareStart

func (i *PumpInstance) PrepareStart() error

PrepareStart checks instance requirements before starting

func (*PumpInstance) Ready

func (i *PumpInstance) Ready(e executor.Executor, timeout int64) error

Ready implements Instance interface

func (*PumpInstance) ScaleConfig

func (i *PumpInstance) ScaleConfig(e executor.Executor, topo Topology, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error

ScaleConfig deploy temporary config on scaling

func (*PumpInstance) ServiceName

func (i *PumpInstance) ServiceName() string

ServiceName implements Instance interface

func (*PumpInstance) Status

func (i *PumpInstance) Status(pdList ...string) string

func (*PumpInstance) UsedDirs

func (i *PumpInstance) UsedDirs() []string

func (*PumpInstance) UsedPorts

func (i *PumpInstance) UsedPorts() []int

func (*PumpInstance) WaitForDown

func (i *PumpInstance) WaitForDown(e executor.Executor, timeout int64) error

WaitForDown implements Instance interface

type PumpSpec

type PumpSpec struct {
	Host            string                 `yaml:"host"`
	SSHPort         int                    `yaml:"ssh_port,omitempty" validate:"ssh_port:editable"`
	Imported        bool                   `yaml:"imported,omitempty"`
	Port            int                    `yaml:"port" default:"8250"`
	DeployDir       string                 `yaml:"deploy_dir,omitempty"`
	DataDir         string                 `yaml:"data_dir,omitempty"`
	LogDir          string                 `yaml:"log_dir,omitempty"`
	Offline         bool                   `yaml:"offline,omitempty"`
	NumaNode        string                 `yaml:"numa_node,omitempty" validate:"numa_node:editable"`
	Config          map[string]interface{} `yaml:"config,omitempty" validate:"config:ignore"`
	ResourceControl meta.ResourceControl   `yaml:"resource_control,omitempty" validate:"resource_control:editable"`
	Arch            string                 `yaml:"arch,omitempty"`
	OS              string                 `yaml:"os,omitempty"`
}

PumpSpec represents the Pump topology specification in topology.yaml

func (PumpSpec) GetMainPort

func (s PumpSpec) GetMainPort() int

GetMainPort returns the main port of the instance

func (PumpSpec) IsImported

func (s PumpSpec) IsImported() bool

IsImported returns if the node is imported from TiDB-Ansible

func (PumpSpec) Role

func (s PumpSpec) Role() string

Role returns the component role of the instance

func (PumpSpec) SSH

func (s PumpSpec) SSH() (string, int)

SSH returns the host and SSH port of the instance

type RollingUpdateInstance added in v1.0.9

type RollingUpdateInstance interface {
	PreRestart(topo Topology, apiTimeoutSeconds int) error
	PostRestart(topo Topology) error
}

RollingUpdateInstance represent a instance need to transfer state when restart. e.g transfer leader.

type ScaleOutTopology added in v1.0.9

type ScaleOutTopology interface {
	// Inherit existing global configuration. We must assign the inherited values before unmarshalling
	// because some default value rely on the global options and monitored options.
	// TODO: we should separate the  unmarshal and setting default value.
	NewPart() Topology
	MergeTopo(topo Topology) Topology
}

ScaleOutTopology represents a scale out metadata.

type ServerConfigs

type ServerConfigs struct {
	TiDB           map[string]interface{} `yaml:"tidb"`
	TiKV           map[string]interface{} `yaml:"tikv"`
	PD             map[string]interface{} `yaml:"pd"`
	TiFlash        map[string]interface{} `yaml:"tiflash"`
	TiFlashLearner map[string]interface{} `yaml:"tiflash-learner"`
	Pump           map[string]interface{} `yaml:"pump"`
	Drainer        map[string]interface{} `yaml:"drainer"`
	CDC            map[string]interface{} `yaml:"cdc"`
}

ServerConfigs represents the server runtime configuration

type SpecManager added in v1.0.9

type SpecManager struct {
	// contains filtered or unexported fields
}

SpecManager control management of spec meta data.

func GetSpecManager added in v1.0.8

func GetSpecManager() *SpecManager

GetSpecManager return the spec manager of tidb cluster.

func NewSpec added in v1.0.9

func NewSpec(base string, newMeta func() Metadata) *SpecManager

NewSpec create a spec instance.

func (*SpecManager) Exist added in v1.0.9

func (s *SpecManager) Exist(name string) (exist bool, err error)

Exist check if the cluster exist by checking the meta file.

func (*SpecManager) List added in v1.0.9

func (s *SpecManager) List() (names []string, err error)

List return the cluster names.

func (*SpecManager) Metadata added in v1.0.9

func (s *SpecManager) Metadata(clusterName string, meta interface{}) error

Metadata tries to read the metadata of a cluster from file

func (*SpecManager) NewMetadata added in v1.0.9

func (s *SpecManager) NewMetadata() Metadata

NewMetadata alloc a Metadata according the type.

func (*SpecManager) Path added in v1.0.9

func (s *SpecManager) Path(cluster string, subpath ...string) string

Path returns the full path to a subpath (file or directory) of a cluster, it is a subdir in the profile dir of the user, with the cluster name as its name.

func (*SpecManager) Remove added in v1.0.9

func (s *SpecManager) Remove(name string) error

Remove remove the data with specified cluster name.

func (*SpecManager) SaveMeta added in v1.0.9

func (s *SpecManager) SaveMeta(clusterName string, meta Metadata) error

SaveMeta save the meta with specified cluster name.

type Specification

type Specification struct {
	GlobalOptions    GlobalOptions       `yaml:"global,omitempty" validate:"global:editable"`
	MonitoredOptions MonitoredOptions    `yaml:"monitored,omitempty" validate:"monitored:editable"`
	ServerConfigs    ServerConfigs       `yaml:"server_configs,omitempty" validate:"server_configs:ignore"`
	TiDBServers      []TiDBSpec          `yaml:"tidb_servers"`
	TiKVServers      []TiKVSpec          `yaml:"tikv_servers"`
	TiFlashServers   []TiFlashSpec       `yaml:"tiflash_servers"`
	PDServers        []PDSpec            `yaml:"pd_servers"`
	PumpServers      []PumpSpec          `yaml:"pump_servers,omitempty"`
	Drainers         []DrainerSpec       `yaml:"drainer_servers,omitempty"`
	CDCServers       []CDCSpec           `yaml:"cdc_servers,omitempty"`
	TiSparkMasters   []TiSparkMasterSpec `yaml:"tispark_masters,omitempty"`
	TiSparkWorkers   []TiSparkWorkerSpec `yaml:"tispark_workers,omitempty"`
	Monitors         []PrometheusSpec    `yaml:"monitoring_servers"`
	Grafana          []GrafanaSpec       `yaml:"grafana_servers,omitempty"`
	Alertmanager     []AlertManagerSpec  `yaml:"alertmanager_servers,omitempty"`
}

Specification represents the specification of topology.yaml

func (*Specification) AlertManagerEndpoints

func (s *Specification) AlertManagerEndpoints(user string) []*scripts.AlertManagerScript

AlertManagerEndpoints returns the AlertManager endpoints configurations

func (*Specification) BaseTopo added in v1.0.9

func (s *Specification) BaseTopo() *BaseTopo

BaseTopo implements Topology interface.

func (*Specification) ComponentsByStartOrder

func (s *Specification) ComponentsByStartOrder() (comps []Component)

ComponentsByStartOrder return component in the order need to start.

func (*Specification) ComponentsByStopOrder

func (s *Specification) ComponentsByStopOrder() (comps []Component)

ComponentsByStopOrder return component in the order need to stop.

func (*Specification) ComponentsByUpdateOrder

func (s *Specification) ComponentsByUpdateOrder() (comps []Component)

ComponentsByUpdateOrder return component in the order need to be updated.

func (*Specification) CountDir

func (s *Specification) CountDir(targetHost, dirPrefix string) int

CountDir counts for dir paths used by any instance in the cluster with the same prefix, useful to find potential path conflicts

func (*Specification) Endpoints

func (s *Specification) Endpoints(user string) []*scripts.PDScript

Endpoints returns the PD endpoints configurations

func (*Specification) GetEtcdClient

func (s *Specification) GetEtcdClient() (*clientv3.Client, error)

GetEtcdClient load EtcdClient of current cluster

func (*Specification) GetMonitoredOptions added in v1.0.8

func (s *Specification) GetMonitoredOptions() *MonitoredOptions

GetMonitoredOptions implements Topology interface.

func (*Specification) GetPDList

func (s *Specification) GetPDList() []string

GetPDList returns a list of PD API hosts of the current cluster

func (*Specification) IterComponent

func (s *Specification) IterComponent(fn func(comp Component))

IterComponent iterates all components in component starting order

func (*Specification) IterInstance

func (s *Specification) IterInstance(fn func(instance Instance))

IterInstance iterates all instances in component starting order

func (*Specification) Merge

func (s *Specification) Merge(that *Specification) *Specification

Merge returns a new Specification which sum old ones

func (*Specification) MergeTopo added in v1.0.9

func (s *Specification) MergeTopo(topo Topology) Topology

MergeTopo implements ScaleOutTopology interface.

func (*Specification) NewPart added in v1.0.9

func (s *Specification) NewPart() Topology

NewPart implements ScaleOutTopology interface.

func (*Specification) UnmarshalYAML

func (s *Specification) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML sets default values when unmarshaling the topology file

func (*Specification) Validate

func (s *Specification) Validate() error

Validate validates the topology specification and produce error if the specification invalid (e.g: port conflicts or directory conflicts)

type TiDBComponent

type TiDBComponent struct{ *Specification }

TiDBComponent represents TiDB component.

func (*TiDBComponent) Instances

func (c *TiDBComponent) Instances() []Instance

Instances implements Component interface.

func (*TiDBComponent) Name

func (c *TiDBComponent) Name() string

Name implements Component interface.

type TiDBInstance

type TiDBInstance struct {
	// contains filtered or unexported fields
}

TiDBInstance represent the TiDB instance

func (*TiDBInstance) Arch

func (i *TiDBInstance) Arch() string

func (*TiDBInstance) ComponentName

func (i *TiDBInstance) ComponentName() string

ComponentName implements Instance interface

func (*TiDBInstance) DataDir

func (i *TiDBInstance) DataDir() string

func (*TiDBInstance) DeployDir

func (i *TiDBInstance) DeployDir() string

func (*TiDBInstance) GetHost

func (i *TiDBInstance) GetHost() string

GetHost implements Instance interface

func (*TiDBInstance) GetListenHost

func (i *TiDBInstance) GetListenHost() string

GetListenHost implements Instance interface

func (*TiDBInstance) GetPort

func (i *TiDBInstance) GetPort() int

func (*TiDBInstance) GetSSHPort

func (i *TiDBInstance) GetSSHPort() int

GetSSHPort implements Instance interface

func (*TiDBInstance) ID

func (i *TiDBInstance) ID() string

ID returns the identifier of this instance, the ID is constructed by host:port

func (*TiDBInstance) InitConfig

func (i *TiDBInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error

InitConfig implement Instance interface

func (*TiDBInstance) InstanceName

func (i *TiDBInstance) InstanceName() string

InstanceName implements Instance interface

func (*TiDBInstance) LogDir

func (i *TiDBInstance) LogDir() string

func (*TiDBInstance) OS

func (i *TiDBInstance) OS() string

func (*TiDBInstance) PrepareStart

func (i *TiDBInstance) PrepareStart() error

PrepareStart checks instance requirements before starting

func (*TiDBInstance) Ready

func (i *TiDBInstance) Ready(e executor.Executor, timeout int64) error

Ready implements Instance interface

func (*TiDBInstance) ScaleConfig

func (i *TiDBInstance) ScaleConfig(e executor.Executor, topo Topology, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error

ScaleConfig deploy temporary config on scaling

func (*TiDBInstance) ServiceName

func (i *TiDBInstance) ServiceName() string

ServiceName implements Instance interface

func (*TiDBInstance) Status

func (i *TiDBInstance) Status(pdList ...string) string

func (*TiDBInstance) UsedDirs

func (i *TiDBInstance) UsedDirs() []string

func (*TiDBInstance) UsedPorts

func (i *TiDBInstance) UsedPorts() []int

func (*TiDBInstance) WaitForDown

func (i *TiDBInstance) WaitForDown(e executor.Executor, timeout int64) error

WaitForDown implements Instance interface

type TiDBSpec

type TiDBSpec struct {
	Host            string                 `yaml:"host"`
	ListenHost      string                 `yaml:"listen_host,omitempty"`
	SSHPort         int                    `yaml:"ssh_port,omitempty" validate:"ssh_port:editable"`
	Imported        bool                   `yaml:"imported,omitempty"`
	Port            int                    `yaml:"port" default:"4000"`
	StatusPort      int                    `yaml:"status_port" default:"10080"`
	DeployDir       string                 `yaml:"deploy_dir,omitempty"`
	LogDir          string                 `yaml:"log_dir,omitempty"`
	NumaNode        string                 `yaml:"numa_node,omitempty" validate:"numa_node:editable"`
	Config          map[string]interface{} `yaml:"config,omitempty" validate:"config:ignore"`
	ResourceControl meta.ResourceControl   `yaml:"resource_control,omitempty" validate:"resource_control:editable"`
	Arch            string                 `yaml:"arch,omitempty"`
	OS              string                 `yaml:"os,omitempty"`
}

TiDBSpec represents the TiDB topology specification in topology.yaml

func (TiDBSpec) GetMainPort

func (s TiDBSpec) GetMainPort() int

GetMainPort returns the main port of the instance

func (TiDBSpec) IsImported

func (s TiDBSpec) IsImported() bool

IsImported returns if the node is imported from TiDB-Ansible

func (TiDBSpec) Role

func (s TiDBSpec) Role() string

Role returns the component role of the instance

func (TiDBSpec) SSH

func (s TiDBSpec) SSH() (string, int)

SSH returns the host and SSH port of the instance

func (TiDBSpec) Status

func (s TiDBSpec) Status(pdList ...string) string

Status queries current status of the instance

type TiFlashComponent

type TiFlashComponent struct{ *Specification }

TiFlashComponent represents TiFlash component.

func (*TiFlashComponent) Instances

func (c *TiFlashComponent) Instances() []Instance

Instances implements Component interface.

func (*TiFlashComponent) Name

func (c *TiFlashComponent) Name() string

Name implements Component interface.

type TiFlashInstance

type TiFlashInstance struct {
	// contains filtered or unexported fields
}

TiFlashInstance represent the TiFlash instance

func (*TiFlashInstance) Arch

func (i *TiFlashInstance) Arch() string

func (*TiFlashInstance) ComponentName

func (i *TiFlashInstance) ComponentName() string

ComponentName implements Instance interface

func (*TiFlashInstance) DataDir

func (i *TiFlashInstance) DataDir() string

DataDir represents TiFlash's DataDir

func (*TiFlashInstance) DeployDir

func (i *TiFlashInstance) DeployDir() string

func (*TiFlashInstance) GetHost

func (i *TiFlashInstance) GetHost() string

GetHost implements Instance interface

func (*TiFlashInstance) GetListenHost

func (i *TiFlashInstance) GetListenHost() string

GetListenHost implements Instance interface

func (*TiFlashInstance) GetPort

func (i *TiFlashInstance) GetPort() int

func (*TiFlashInstance) GetSSHPort

func (i *TiFlashInstance) GetSSHPort() int

GetSSHPort implements Instance interface

func (*TiFlashInstance) GetServicePort

func (i *TiFlashInstance) GetServicePort() int

GetServicePort returns the service port of TiFlash

func (*TiFlashInstance) ID

func (i *TiFlashInstance) ID() string

ID returns the identifier of this instance, the ID is constructed by host:port

func (*TiFlashInstance) InitConfig

func (i *TiFlashInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error

InitConfig implement Instance interface

func (*TiFlashInstance) InitTiFlashConfig

func (i *TiFlashInstance) InitTiFlashConfig(cfg *scripts.TiFlashScript, src map[string]interface{}) (map[string]interface{}, error)

InitTiFlashConfig initializes TiFlash config file

func (*TiFlashInstance) InitTiFlashLearnerConfig

func (i *TiFlashInstance) InitTiFlashLearnerConfig(cfg *scripts.TiFlashScript, src map[string]interface{}) (map[string]interface{}, error)

InitTiFlashLearnerConfig initializes TiFlash learner config file

func (*TiFlashInstance) InstanceName

func (i *TiFlashInstance) InstanceName() string

InstanceName implements Instance interface

func (*TiFlashInstance) LogDir

func (i *TiFlashInstance) LogDir() string

func (*TiFlashInstance) OS

func (i *TiFlashInstance) OS() string

func (*TiFlashInstance) PrepareStart

func (i *TiFlashInstance) PrepareStart() error

PrepareStart checks TiFlash requirements before starting

func (*TiFlashInstance) Ready

func (i *TiFlashInstance) Ready(e executor.Executor, timeout int64) error

Ready implements Instance interface

func (*TiFlashInstance) ScaleConfig

func (i *TiFlashInstance) ScaleConfig(e executor.Executor, topo Topology, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error

ScaleConfig deploy temporary config on scaling

func (*TiFlashInstance) ServiceName

func (i *TiFlashInstance) ServiceName() string

ServiceName implements Instance interface

func (*TiFlashInstance) Status

func (i *TiFlashInstance) Status(pdList ...string) string

func (*TiFlashInstance) UsedDirs

func (i *TiFlashInstance) UsedDirs() []string

func (*TiFlashInstance) UsedPorts

func (i *TiFlashInstance) UsedPorts() []int

func (*TiFlashInstance) WaitForDown

func (i *TiFlashInstance) WaitForDown(e executor.Executor, timeout int64) error

WaitForDown implements Instance interface

type TiFlashSpec

type TiFlashSpec struct {
	Host                 string                 `yaml:"host"`
	SSHPort              int                    `yaml:"ssh_port,omitempty" validate:"ssh_port:editable"`
	Imported             bool                   `yaml:"imported,omitempty"`
	TCPPort              int                    `yaml:"tcp_port" default:"9000"`
	HTTPPort             int                    `yaml:"http_port" default:"8123"`
	FlashServicePort     int                    `yaml:"flash_service_port" default:"3930"`
	FlashProxyPort       int                    `yaml:"flash_proxy_port" default:"20170"`
	FlashProxyStatusPort int                    `yaml:"flash_proxy_status_port" default:"20292"`
	StatusPort           int                    `yaml:"metrics_port" default:"8234"`
	DeployDir            string                 `yaml:"deploy_dir,omitempty"`
	DataDir              string                 `yaml:"data_dir,omitempty"`
	LogDir               string                 `yaml:"log_dir,omitempty"`
	TmpDir               string                 `yaml:"tmp_path,omitempty"`
	Offline              bool                   `yaml:"offline,omitempty"`
	NumaNode             string                 `yaml:"numa_node,omitempty" validate:"numa_node:editable"`
	Config               map[string]interface{} `yaml:"config,omitempty" validate:"config:ignore"`
	LearnerConfig        map[string]interface{} `yaml:"learner_config,omitempty" validate:"learner_config:editable"`
	ResourceControl      meta.ResourceControl   `yaml:"resource_control,omitempty" validate:"resource_control:editable"`
	Arch                 string                 `yaml:"arch,omitempty"`
	OS                   string                 `yaml:"os,omitempty"`
}

TiFlashSpec represents the TiFlash topology specification in topology.yaml

func (TiFlashSpec) GetMainPort

func (s TiFlashSpec) GetMainPort() int

GetMainPort returns the main port of the instance

func (TiFlashSpec) IsImported

func (s TiFlashSpec) IsImported() bool

IsImported returns if the node is imported from TiDB-Ansible

func (TiFlashSpec) Role

func (s TiFlashSpec) Role() string

Role returns the component role of the instance

func (TiFlashSpec) SSH

func (s TiFlashSpec) SSH() (string, int)

SSH returns the host and SSH port of the instance

func (TiFlashSpec) Status

func (s TiFlashSpec) Status(pdList ...string) string

Status queries current status of the instance

type TiKVComponent

type TiKVComponent struct {
	*Specification
}

TiKVComponent represents TiKV component.

func (*TiKVComponent) Instances

func (c *TiKVComponent) Instances() []Instance

Instances implements Component interface.

func (*TiKVComponent) Name

func (c *TiKVComponent) Name() string

Name implements Component interface.

type TiKVInstance

type TiKVInstance struct {
	// contains filtered or unexported fields
}

TiKVInstance represent the TiDB instance

func (*TiKVInstance) Arch

func (i *TiKVInstance) Arch() string

func (*TiKVInstance) ComponentName

func (i *TiKVInstance) ComponentName() string

ComponentName implements Instance interface

func (*TiKVInstance) DataDir

func (i *TiKVInstance) DataDir() string

func (*TiKVInstance) DeployDir

func (i *TiKVInstance) DeployDir() string

func (*TiKVInstance) GetHost

func (i *TiKVInstance) GetHost() string

GetHost implements Instance interface

func (*TiKVInstance) GetListenHost

func (i *TiKVInstance) GetListenHost() string

GetListenHost implements Instance interface

func (*TiKVInstance) GetPort

func (i *TiKVInstance) GetPort() int

func (*TiKVInstance) GetSSHPort

func (i *TiKVInstance) GetSSHPort() int

GetSSHPort implements Instance interface

func (*TiKVInstance) ID

func (i *TiKVInstance) ID() string

ID returns the identifier of this instance, the ID is constructed by host:port

func (*TiKVInstance) InitConfig

func (i *TiKVInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error

InitConfig implement Instance interface

func (*TiKVInstance) InstanceName

func (i *TiKVInstance) InstanceName() string

InstanceName implements Instance interface

func (*TiKVInstance) LogDir

func (i *TiKVInstance) LogDir() string

func (*TiKVInstance) OS

func (i *TiKVInstance) OS() string

func (*TiKVInstance) PostRestart added in v1.0.9

func (i *TiKVInstance) PostRestart(topo Topology) error

PostRestart implements RollingUpdateInstance interface.

func (*TiKVInstance) PreRestart added in v1.0.9

func (i *TiKVInstance) PreRestart(topo Topology, apiTimeoutSeconds int) error

PreRestart implements RollingUpdateInstance interface.

func (*TiKVInstance) PrepareStart

func (i *TiKVInstance) PrepareStart() error

PrepareStart checks instance requirements before starting

func (*TiKVInstance) Ready

func (i *TiKVInstance) Ready(e executor.Executor, timeout int64) error

Ready implements Instance interface

func (*TiKVInstance) ScaleConfig

func (i *TiKVInstance) ScaleConfig(e executor.Executor, topo Topology, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error

ScaleConfig deploy temporary config on scaling

func (*TiKVInstance) ServiceName

func (i *TiKVInstance) ServiceName() string

ServiceName implements Instance interface

func (*TiKVInstance) Status

func (i *TiKVInstance) Status(pdList ...string) string

func (*TiKVInstance) UsedDirs

func (i *TiKVInstance) UsedDirs() []string

func (*TiKVInstance) UsedPorts

func (i *TiKVInstance) UsedPorts() []int

func (*TiKVInstance) WaitForDown

func (i *TiKVInstance) WaitForDown(e executor.Executor, timeout int64) error

WaitForDown implements Instance interface

type TiKVSpec

type TiKVSpec struct {
	Host            string                 `yaml:"host"`
	ListenHost      string                 `yaml:"listen_host,omitempty"`
	SSHPort         int                    `yaml:"ssh_port,omitempty" validate:"ssh_port:editable"`
	Imported        bool                   `yaml:"imported,omitempty"`
	Port            int                    `yaml:"port" default:"20160"`
	StatusPort      int                    `yaml:"status_port" default:"20180"`
	DeployDir       string                 `yaml:"deploy_dir,omitempty"`
	DataDir         string                 `yaml:"data_dir,omitempty"`
	LogDir          string                 `yaml:"log_dir,omitempty"`
	Offline         bool                   `yaml:"offline,omitempty"`
	NumaNode        string                 `yaml:"numa_node,omitempty" validate:"numa_node:editable"`
	Config          map[string]interface{} `yaml:"config,omitempty" validate:"config:ignore"`
	ResourceControl meta.ResourceControl   `yaml:"resource_control,omitempty" validate:"resource_control:editable"`
	Arch            string                 `yaml:"arch,omitempty"`
	OS              string                 `yaml:"os,omitempty"`
}

TiKVSpec represents the TiKV topology specification in topology.yaml

func (TiKVSpec) GetMainPort

func (s TiKVSpec) GetMainPort() int

GetMainPort returns the main port of the instance

func (TiKVSpec) IsImported

func (s TiKVSpec) IsImported() bool

IsImported returns if the node is imported from TiDB-Ansible

func (TiKVSpec) Role

func (s TiKVSpec) Role() string

Role returns the component role of the instance

func (TiKVSpec) SSH

func (s TiKVSpec) SSH() (string, int)

SSH returns the host and SSH port of the instance

func (TiKVSpec) Status

func (s TiKVSpec) Status(pdList ...string) string

Status queries current status of the instance

type TiSparkMasterComponent added in v1.0.9

type TiSparkMasterComponent struct{ *Specification }

TiSparkMasterComponent represents TiSpark master component.

func (*TiSparkMasterComponent) Instances added in v1.0.9

func (c *TiSparkMasterComponent) Instances() []Instance

Instances implements Component interface.

func (*TiSparkMasterComponent) Name added in v1.0.9

func (c *TiSparkMasterComponent) Name() string

Name implements Component interface.

type TiSparkMasterInstance added in v1.0.9

type TiSparkMasterInstance struct {
	// contains filtered or unexported fields
}

TiSparkMasterInstance represent the TiSpark master instance

func (*TiSparkMasterInstance) Arch added in v1.0.9

func (i *TiSparkMasterInstance) Arch() string

func (*TiSparkMasterInstance) ComponentName added in v1.0.9

func (i *TiSparkMasterInstance) ComponentName() string

ComponentName implements Instance interface

func (*TiSparkMasterInstance) DataDir added in v1.0.9

func (i *TiSparkMasterInstance) DataDir() string

func (*TiSparkMasterInstance) DeployDir added in v1.0.9

func (i *TiSparkMasterInstance) DeployDir() string

func (*TiSparkMasterInstance) GetCustomEnvs added in v1.0.9

func (i *TiSparkMasterInstance) GetCustomEnvs() map[string]string

GetCustomEnvs get custom spark envionment variables of the instance

func (*TiSparkMasterInstance) GetCustomFields added in v1.0.9

func (i *TiSparkMasterInstance) GetCustomFields() map[string]interface{}

GetCustomFields get custom spark configs of the instance

func (*TiSparkMasterInstance) GetHost added in v1.0.9

func (i *TiSparkMasterInstance) GetHost() string

GetHost implements Instance interface

func (*TiSparkMasterInstance) GetJavaHome added in v1.0.9

func (i *TiSparkMasterInstance) GetJavaHome() string

GetJavaHome returns the java_home value in spec

func (*TiSparkMasterInstance) GetListenHost added in v1.0.9

func (i *TiSparkMasterInstance) GetListenHost() string

GetListenHost implements Instance interface

func (*TiSparkMasterInstance) GetPort added in v1.0.9

func (i *TiSparkMasterInstance) GetPort() int

func (*TiSparkMasterInstance) GetSSHPort added in v1.0.9

func (i *TiSparkMasterInstance) GetSSHPort() int

GetSSHPort implements Instance interface

func (*TiSparkMasterInstance) ID added in v1.0.9

func (i *TiSparkMasterInstance) ID() string

ID returns the identifier of this instance, the ID is constructed by host:port

func (*TiSparkMasterInstance) InitConfig added in v1.0.9

func (i *TiSparkMasterInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error

InitConfig implement Instance interface

func (*TiSparkMasterInstance) InstanceName added in v1.0.9

func (i *TiSparkMasterInstance) InstanceName() string

InstanceName implements Instance interface

func (*TiSparkMasterInstance) LogDir added in v1.0.9

func (i *TiSparkMasterInstance) LogDir() string

func (*TiSparkMasterInstance) OS added in v1.0.9

func (i *TiSparkMasterInstance) OS() string

func (*TiSparkMasterInstance) PrepareStart added in v1.0.9

func (i *TiSparkMasterInstance) PrepareStart() error

PrepareStart checks instance requirements before starting

func (*TiSparkMasterInstance) Ready added in v1.0.9

func (i *TiSparkMasterInstance) Ready(e executor.Executor, timeout int64) error

Ready implements Instance interface

func (*TiSparkMasterInstance) ScaleConfig added in v1.0.9

func (i *TiSparkMasterInstance) ScaleConfig(e executor.Executor, topo Topology,
	clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error

ScaleConfig deploy temporary config on scaling

func (*TiSparkMasterInstance) ServiceName added in v1.0.9

func (i *TiSparkMasterInstance) ServiceName() string

ServiceName implements Instance interface

func (*TiSparkMasterInstance) Status added in v1.0.9

func (i *TiSparkMasterInstance) Status(pdList ...string) string

func (*TiSparkMasterInstance) UsedDirs added in v1.0.9

func (i *TiSparkMasterInstance) UsedDirs() []string

func (*TiSparkMasterInstance) UsedPorts added in v1.0.9

func (i *TiSparkMasterInstance) UsedPorts() []int

func (*TiSparkMasterInstance) WaitForDown added in v1.0.9

func (i *TiSparkMasterInstance) WaitForDown(e executor.Executor, timeout int64) error

WaitForDown implements Instance interface

type TiSparkMasterSpec added in v1.0.9

type TiSparkMasterSpec struct {
	Host         string                 `yaml:"host"`
	ListenHost   string                 `yaml:"listen_host,omitempty"`
	SSHPort      int                    `yaml:"ssh_port,omitempty" validate:"ssh_port:editable"`
	Imported     bool                   `yaml:"imported,omitempty"`
	Port         int                    `yaml:"port" default:"7077"`
	WebPort      int                    `yaml:"web_port" default:"8080"`
	DeployDir    string                 `yaml:"deploy_dir,omitempty"`
	JavaHome     string                 `yaml:"java_home,omitempty" validate:"java_home:editable"`
	SparkConfigs map[string]interface{} `yaml:"spark_config,omitempty" validate:"spark_config:editable"`
	SparkEnvs    map[string]string      `yaml:"spark_env,omitempty" validate:"spark_env:editable"`
	Arch         string                 `yaml:"arch,omitempty"`
	OS           string                 `yaml:"os,omitempty"`
}

TiSparkMasterSpec is the topology specification for TiSpark master node

func (TiSparkMasterSpec) GetMainPort added in v1.0.9

func (s TiSparkMasterSpec) GetMainPort() int

GetMainPort returns the main port of the instance

func (TiSparkMasterSpec) IsImported added in v1.0.9

func (s TiSparkMasterSpec) IsImported() bool

IsImported returns if the node is imported from TiDB-Ansible

func (TiSparkMasterSpec) Role added in v1.0.9

func (s TiSparkMasterSpec) Role() string

Role returns the component role of the instance

func (TiSparkMasterSpec) SSH added in v1.0.9

func (s TiSparkMasterSpec) SSH() (string, int)

SSH returns the host and SSH port of the instance

func (TiSparkMasterSpec) Status added in v1.0.9

func (s TiSparkMasterSpec) Status(pdList ...string) string

Status queries current status of the instance

type TiSparkWorkerComponent added in v1.0.9

type TiSparkWorkerComponent struct{ *Specification }

TiSparkWorkerComponent represents TiSpark slave component.

func (*TiSparkWorkerComponent) Instances added in v1.0.9

func (c *TiSparkWorkerComponent) Instances() []Instance

Instances implements Component interface.

func (*TiSparkWorkerComponent) Name added in v1.0.9

func (c *TiSparkWorkerComponent) Name() string

Name implements Component interface.

type TiSparkWorkerInstance added in v1.0.9

type TiSparkWorkerInstance struct {
	// contains filtered or unexported fields
}

TiSparkWorkerInstance represent the TiSpark slave instance

func (*TiSparkWorkerInstance) Arch added in v1.0.9

func (i *TiSparkWorkerInstance) Arch() string

func (*TiSparkWorkerInstance) ComponentName added in v1.0.9

func (i *TiSparkWorkerInstance) ComponentName() string

ComponentName implements Instance interface

func (*TiSparkWorkerInstance) DataDir added in v1.0.9

func (i *TiSparkWorkerInstance) DataDir() string

func (*TiSparkWorkerInstance) DeployDir added in v1.0.9

func (i *TiSparkWorkerInstance) DeployDir() string

func (*TiSparkWorkerInstance) GetHost added in v1.0.9

func (i *TiSparkWorkerInstance) GetHost() string

GetHost implements Instance interface

func (*TiSparkWorkerInstance) GetJavaHome added in v1.0.9

func (i *TiSparkWorkerInstance) GetJavaHome() string

GetJavaHome returns the java_home value in spec

func (*TiSparkWorkerInstance) GetListenHost added in v1.0.9

func (i *TiSparkWorkerInstance) GetListenHost() string

GetListenHost implements Instance interface

func (*TiSparkWorkerInstance) GetPort added in v1.0.9

func (i *TiSparkWorkerInstance) GetPort() int

func (*TiSparkWorkerInstance) GetSSHPort added in v1.0.9

func (i *TiSparkWorkerInstance) GetSSHPort() int

GetSSHPort implements Instance interface

func (*TiSparkWorkerInstance) ID added in v1.0.9

func (i *TiSparkWorkerInstance) ID() string

ID returns the identifier of this instance, the ID is constructed by host:port

func (*TiSparkWorkerInstance) InitConfig added in v1.0.9

func (i *TiSparkWorkerInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error

InitConfig implement Instance interface

func (*TiSparkWorkerInstance) InstanceName added in v1.0.9

func (i *TiSparkWorkerInstance) InstanceName() string

InstanceName implements Instance interface

func (*TiSparkWorkerInstance) LogDir added in v1.0.9

func (i *TiSparkWorkerInstance) LogDir() string

func (*TiSparkWorkerInstance) OS added in v1.0.9

func (i *TiSparkWorkerInstance) OS() string

func (*TiSparkWorkerInstance) PrepareStart added in v1.0.9

func (i *TiSparkWorkerInstance) PrepareStart() error

PrepareStart checks instance requirements before starting

func (*TiSparkWorkerInstance) Ready added in v1.0.9

func (i *TiSparkWorkerInstance) Ready(e executor.Executor, timeout int64) error

Ready implements Instance interface

func (*TiSparkWorkerInstance) ScaleConfig added in v1.0.9

func (i *TiSparkWorkerInstance) ScaleConfig(e executor.Executor, topo Topology,
	clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error

ScaleConfig deploy temporary config on scaling

func (*TiSparkWorkerInstance) ServiceName added in v1.0.9

func (i *TiSparkWorkerInstance) ServiceName() string

ServiceName implements Instance interface

func (*TiSparkWorkerInstance) Status added in v1.0.9

func (i *TiSparkWorkerInstance) Status(pdList ...string) string

func (*TiSparkWorkerInstance) UsedDirs added in v1.0.9

func (i *TiSparkWorkerInstance) UsedDirs() []string

func (*TiSparkWorkerInstance) UsedPorts added in v1.0.9

func (i *TiSparkWorkerInstance) UsedPorts() []int

func (*TiSparkWorkerInstance) WaitForDown added in v1.0.9

func (i *TiSparkWorkerInstance) WaitForDown(e executor.Executor, timeout int64) error

WaitForDown implements Instance interface

type TiSparkWorkerSpec added in v1.0.9

type TiSparkWorkerSpec struct {
	Host       string `yaml:"host"`
	ListenHost string `yaml:"listen_host,omitempty"`
	SSHPort    int    `yaml:"ssh_port,omitempty" validate:"ssh_port:editable"`
	Imported   bool   `yaml:"imported,omitempty"`
	Port       int    `yaml:"port" default:"7078"`
	WebPort    int    `yaml:"web_port" default:"8081"`
	DeployDir  string `yaml:"deploy_dir,omitempty"`
	JavaHome   string `yaml:"java_home,omitempty" validate:"java_home:editable"`
	Arch       string `yaml:"arch,omitempty"`
	OS         string `yaml:"os,omitempty"`
}

TiSparkWorkerSpec is the topology specification for TiSpark slave nodes

func (TiSparkWorkerSpec) GetMainPort added in v1.0.9

func (s TiSparkWorkerSpec) GetMainPort() int

GetMainPort returns the main port of the instance

func (TiSparkWorkerSpec) IsImported added in v1.0.9

func (s TiSparkWorkerSpec) IsImported() bool

IsImported returns if the node is imported from TiDB-Ansible

func (TiSparkWorkerSpec) Role added in v1.0.9

func (s TiSparkWorkerSpec) Role() string

Role returns the component role of the instance

func (TiSparkWorkerSpec) SSH added in v1.0.9

func (s TiSparkWorkerSpec) SSH() (string, int)

SSH returns the host and SSH port of the instance

func (TiSparkWorkerSpec) Status added in v1.0.9

func (s TiSparkWorkerSpec) Status(pdList ...string) string

Status queries current status of the instance

type Topology added in v1.0.9

type Topology interface {
	BaseTopo() *BaseTopo
	// Validate validates the topology specification and produce error if the
	// specification invalid (e.g: port conflicts or directory conflicts)
	Validate() error

	// Instances() []Instance
	ComponentsByStartOrder() []Component
	ComponentsByStopOrder() []Component
	ComponentsByUpdateOrder() []Component
	IterInstance(fn func(instance Instance))
	GetMonitoredOptions() *MonitoredOptions
	// count how many time a path is used by instances in cluster
	CountDir(host string, dir string) int

	ScaleOutTopology
}

Topology represents specification of the cluster.

type UpgradableMetadata added in v1.0.9

type UpgradableMetadata interface {
	SetVersion(s string)
	SetUser(u string)
}

UpgradableMetadata represents a upgradable Metadata.

Jump to

Keyboard shortcuts

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