Documentation ¶
Index ¶
- Constants
- Variables
- func AllComponentNames() (roles []string)
- func ClusterPath(cluster string, subpath ...string) string
- func ComponentVersion(comp, version string) string
- func EnsureClusterDir(clusterName string) error
- func HandleImportPathMigration(clsName string) error
- func Initialize(base string) error
- func PortStarted(e executor.TiOpsExecutor, port int, timeout int64) error
- func PortStopped(e executor.TiOpsExecutor, port int, timeout int64) error
- func ProfileDir() string
- func ProfilePath(subpath ...string) string
- func SaveClusterMeta(clusterName string, meta *ClusterMeta) error
- type AlertManagerComponent
- type AlertManagerInstance
- func (i *AlertManagerInstance) Arch() string
- func (i *AlertManagerInstance) ComponentName() string
- func (i *AlertManagerInstance) DataDir() string
- func (i *AlertManagerInstance) DeployDir() string
- func (i *AlertManagerInstance) GetHost() string
- func (i *AlertManagerInstance) GetListenHost() string
- func (i *AlertManagerInstance) GetPort() int
- func (i *AlertManagerInstance) GetSSHPort() int
- func (i *AlertManagerInstance) ID() string
- func (i *AlertManagerInstance) InitConfig(e executor.TiOpsExecutor, clusterName, clusterVersion, deployUser string, ...) error
- func (i *AlertManagerInstance) InstanceName() string
- func (i *AlertManagerInstance) LogDir() string
- func (i *AlertManagerInstance) OS() string
- func (i *AlertManagerInstance) PrepareStart() error
- func (i *AlertManagerInstance) Ready(e executor.TiOpsExecutor, timeout int64) error
- func (i *AlertManagerInstance) ScaleConfig(e executor.TiOpsExecutor, b Specification, clusterName string, ...) error
- func (i *AlertManagerInstance) ServiceName() string
- func (i *AlertManagerInstance) Status(pdList ...string) string
- func (i *AlertManagerInstance) UsedDirs() []string
- func (i *AlertManagerInstance) UsedPorts() []int
- func (i *AlertManagerInstance) WaitForDown(e executor.TiOpsExecutor, timeout int64) error
- type AlertManagerSpec
- type CDCComponent
- type CDCInstance
- func (i *CDCInstance) Arch() string
- func (i *CDCInstance) ComponentName() string
- func (i *CDCInstance) DataDir() string
- func (i *CDCInstance) DeployDir() string
- func (i *CDCInstance) GetHost() string
- func (i *CDCInstance) GetListenHost() string
- func (i *CDCInstance) GetPort() int
- func (i *CDCInstance) GetSSHPort() int
- func (i *CDCInstance) ID() string
- func (i *CDCInstance) InitConfig(e executor.TiOpsExecutor, clusterName, clusterVersion, deployUser string, ...) error
- func (i *CDCInstance) InstanceName() string
- func (i *CDCInstance) LogDir() string
- func (i *CDCInstance) OS() string
- func (i *CDCInstance) PrepareStart() error
- func (i *CDCInstance) Ready(e executor.TiOpsExecutor, timeout int64) error
- func (i *CDCInstance) ScaleConfig(e executor.TiOpsExecutor, b Specification, ...) error
- func (i *CDCInstance) ServiceName() string
- func (i *CDCInstance) Status(pdList ...string) string
- func (i *CDCInstance) UsedDirs() []string
- func (i *CDCInstance) UsedPorts() []int
- func (i *CDCInstance) WaitForDown(e executor.TiOpsExecutor, timeout int64) error
- type CDCSpec
- type ClusterMeta
- type ClusterSpecification
- func (topo *ClusterSpecification) AlertManagerEndpoints(user string) []*scripts.AlertManagerScript
- func (topo *ClusterSpecification) ComponentsByStartOrder() (comps []Component)
- func (topo *ClusterSpecification) ComponentsByStopOrder() (comps []Component)
- func (topo *ClusterSpecification) ComponentsByUpdateOrder() (comps []Component)
- func (topo *ClusterSpecification) CountDir(targetHost, dirPrefix string) int
- func (topo *ClusterSpecification) Endpoints(user string) []*scripts.PDScript
- func (topo *ClusterSpecification) GetClusterSpecification() *ClusterSpecification
- func (topo *ClusterSpecification) GetEtcdClient() (*clientv3.Client, error)
- func (topo *ClusterSpecification) GetGlobalOptions() GlobalOptions
- func (topo *ClusterSpecification) GetMonitoredOptions() MonitoredOptions
- func (topo *ClusterSpecification) GetPDList() []string
- func (topo *ClusterSpecification) IterComponent(fn func(comp Component))
- func (topo *ClusterSpecification) IterHost(fn func(instance Instance))
- func (topo *ClusterSpecification) IterInstance(fn func(instance Instance))
- func (topo *ClusterSpecification) Merge(that *ClusterSpecification) *ClusterSpecification
- func (topo *ClusterSpecification) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (topo *ClusterSpecification) Validate() error
- type Component
- type DirPaths
- type DrainerComponent
- type DrainerInstance
- func (i *DrainerInstance) Arch() string
- func (i *DrainerInstance) ComponentName() string
- func (i *DrainerInstance) DataDir() string
- func (i *DrainerInstance) DeployDir() string
- func (i *DrainerInstance) GetHost() string
- func (i *DrainerInstance) GetListenHost() string
- func (i *DrainerInstance) GetPort() int
- func (i *DrainerInstance) GetSSHPort() int
- func (i *DrainerInstance) ID() string
- func (i *DrainerInstance) InitConfig(e executor.TiOpsExecutor, clusterName, clusterVersion, deployUser string, ...) error
- func (i *DrainerInstance) InstanceName() string
- func (i *DrainerInstance) LogDir() string
- func (i *DrainerInstance) OS() string
- func (i *DrainerInstance) PrepareStart() error
- func (i *DrainerInstance) Ready(e executor.TiOpsExecutor, timeout int64) error
- func (i *DrainerInstance) ScaleConfig(e executor.TiOpsExecutor, b Specification, ...) error
- func (i *DrainerInstance) ServiceName() string
- func (i *DrainerInstance) Status(pdList ...string) string
- func (i *DrainerInstance) UsedDirs() []string
- func (i *DrainerInstance) UsedPorts() []int
- func (i *DrainerInstance) WaitForDown(e executor.TiOpsExecutor, timeout int64) error
- type DrainerSpec
- type GlobalOptions
- type GrafanaComponent
- type GrafanaInstance
- func (i *GrafanaInstance) Arch() string
- func (i *GrafanaInstance) ComponentName() string
- func (i *GrafanaInstance) DataDir() string
- func (i *GrafanaInstance) DeployDir() string
- func (i *GrafanaInstance) GetHost() string
- func (i *GrafanaInstance) GetListenHost() string
- func (i *GrafanaInstance) GetPort() int
- func (i *GrafanaInstance) GetSSHPort() int
- func (i *GrafanaInstance) ID() string
- func (i *GrafanaInstance) InitConfig(e executor.TiOpsExecutor, clusterName, clusterVersion, deployUser string, ...) error
- func (i *GrafanaInstance) InstanceName() string
- func (i *GrafanaInstance) LogDir() string
- func (i *GrafanaInstance) OS() string
- func (i *GrafanaInstance) PrepareStart() error
- func (i *GrafanaInstance) Ready(e executor.TiOpsExecutor, timeout int64) error
- func (i *GrafanaInstance) ScaleConfig(e executor.TiOpsExecutor, b Specification, clusterName string, ...) error
- func (i *GrafanaInstance) ServiceName() string
- func (i *GrafanaInstance) Status(pdList ...string) string
- func (i *GrafanaInstance) UsedDirs() []string
- func (i *GrafanaInstance) UsedPorts() []int
- func (i *GrafanaInstance) WaitForDown(e executor.TiOpsExecutor, timeout int64) error
- type GrafanaSpec
- type Instance
- type InstanceSpec
- type MonitorComponent
- type MonitorInstance
- func (i *MonitorInstance) Arch() string
- func (i *MonitorInstance) ComponentName() string
- func (i *MonitorInstance) DataDir() string
- func (i *MonitorInstance) DeployDir() string
- func (i *MonitorInstance) GetHost() string
- func (i *MonitorInstance) GetListenHost() string
- func (i *MonitorInstance) GetPort() int
- func (i *MonitorInstance) GetSSHPort() int
- func (i *MonitorInstance) ID() string
- func (i *MonitorInstance) InitConfig(e executor.TiOpsExecutor, clusterName, clusterVersion, deployUser string, ...) error
- func (i *MonitorInstance) InstanceName() string
- func (i *MonitorInstance) LogDir() string
- func (i *MonitorInstance) OS() string
- func (i *MonitorInstance) PrepareStart() error
- func (i *MonitorInstance) Ready(e executor.TiOpsExecutor, timeout int64) error
- func (i *MonitorInstance) ScaleConfig(e executor.TiOpsExecutor, b Specification, clusterName string, ...) error
- func (i *MonitorInstance) ServiceName() string
- func (i *MonitorInstance) Status(pdList ...string) string
- func (i *MonitorInstance) UsedDirs() []string
- func (i *MonitorInstance) UsedPorts() []int
- func (i *MonitorInstance) WaitForDown(e executor.TiOpsExecutor, timeout int64) error
- type MonitoredOptions
- type PDComponent
- type PDInstance
- func (i *PDInstance) Arch() string
- func (i *PDInstance) ComponentName() string
- func (i *PDInstance) DataDir() string
- func (i *PDInstance) DeployDir() string
- func (i *PDInstance) GetHost() string
- func (i *PDInstance) GetListenHost() string
- func (i *PDInstance) GetPort() int
- func (i *PDInstance) GetSSHPort() int
- func (i *PDInstance) ID() string
- func (i *PDInstance) InitConfig(e executor.TiOpsExecutor, clusterName, clusterVersion, deployUser string, ...) error
- func (i *PDInstance) InstanceName() string
- func (i *PDInstance) LogDir() string
- func (i *PDInstance) OS() string
- func (i *PDInstance) PrepareStart() error
- func (i *PDInstance) Ready(e executor.TiOpsExecutor, timeout int64) error
- func (i *PDInstance) ScaleConfig(e executor.TiOpsExecutor, b Specification, ...) error
- func (i *PDInstance) ServiceName() string
- func (i *PDInstance) Status(pdList ...string) string
- func (i *PDInstance) UsedDirs() []string
- func (i *PDInstance) UsedPorts() []int
- func (i *PDInstance) WaitForDown(e executor.TiOpsExecutor, timeout int64) error
- type PDSpec
- type PrometheusSpec
- type PumpComponent
- type PumpInstance
- func (i *PumpInstance) Arch() string
- func (i *PumpInstance) ComponentName() string
- func (i *PumpInstance) DataDir() string
- func (i *PumpInstance) DeployDir() string
- func (i *PumpInstance) GetHost() string
- func (i *PumpInstance) GetListenHost() string
- func (i *PumpInstance) GetPort() int
- func (i *PumpInstance) GetSSHPort() int
- func (i *PumpInstance) ID() string
- func (i *PumpInstance) InitConfig(e executor.TiOpsExecutor, clusterName, clusterVersion, deployUser string, ...) error
- func (i *PumpInstance) InstanceName() string
- func (i *PumpInstance) LogDir() string
- func (i *PumpInstance) OS() string
- func (i *PumpInstance) PrepareStart() error
- func (i *PumpInstance) Ready(e executor.TiOpsExecutor, timeout int64) error
- func (i *PumpInstance) ScaleConfig(e executor.TiOpsExecutor, b Specification, ...) error
- func (i *PumpInstance) ServiceName() string
- func (i *PumpInstance) Status(pdList ...string) string
- func (i *PumpInstance) UsedDirs() []string
- func (i *PumpInstance) UsedPorts() []int
- func (i *PumpInstance) WaitForDown(e executor.TiOpsExecutor, timeout int64) error
- type PumpSpec
- type ResourceControl
- type ServerConfigs
- type Specification
- type TiDBComponent
- type TiDBInstance
- func (i *TiDBInstance) Arch() string
- func (i *TiDBInstance) ComponentName() string
- func (i *TiDBInstance) DataDir() string
- func (i *TiDBInstance) DeployDir() string
- func (i *TiDBInstance) GetHost() string
- func (i *TiDBInstance) GetListenHost() string
- func (i *TiDBInstance) GetPort() int
- func (i *TiDBInstance) GetSSHPort() int
- func (i *TiDBInstance) ID() string
- func (i *TiDBInstance) InitConfig(e executor.TiOpsExecutor, clusterName, clusterVersion, deployUser string, ...) error
- func (i *TiDBInstance) InstanceName() string
- func (i *TiDBInstance) LogDir() string
- func (i *TiDBInstance) OS() string
- func (i *TiDBInstance) PrepareStart() error
- func (i *TiDBInstance) Ready(e executor.TiOpsExecutor, timeout int64) error
- func (i *TiDBInstance) ScaleConfig(e executor.TiOpsExecutor, b Specification, ...) error
- func (i *TiDBInstance) ServiceName() string
- func (i *TiDBInstance) Status(pdList ...string) string
- func (i *TiDBInstance) UsedDirs() []string
- func (i *TiDBInstance) UsedPorts() []int
- func (i *TiDBInstance) WaitForDown(e executor.TiOpsExecutor, timeout int64) error
- type TiDBSpec
- type TiFlashComponent
- type TiFlashInstance
- func (i *TiFlashInstance) Arch() string
- func (i *TiFlashInstance) ComponentName() string
- func (i *TiFlashInstance) DataDir() string
- func (i *TiFlashInstance) DeployDir() string
- func (i *TiFlashInstance) GetHost() string
- func (i *TiFlashInstance) GetListenHost() string
- func (i *TiFlashInstance) GetPort() int
- func (i *TiFlashInstance) GetSSHPort() int
- func (i *TiFlashInstance) GetServicePort() int
- func (i *TiFlashInstance) ID() string
- func (i *TiFlashInstance) InitConfig(e executor.TiOpsExecutor, clusterName, clusterVersion, deployUser string, ...) error
- func (i *TiFlashInstance) InitTiFlashConfig(cfg *scripts.TiFlashScript, src map[string]interface{}) (map[string]interface{}, error)
- func (i *TiFlashInstance) InitTiFlashLearnerConfig(cfg *scripts.TiFlashScript, src map[string]interface{}) (map[string]interface{}, error)
- func (i *TiFlashInstance) InstanceName() string
- func (i *TiFlashInstance) LogDir() string
- func (i *TiFlashInstance) OS() string
- func (i *TiFlashInstance) PrepareStart() error
- func (i *TiFlashInstance) Ready(e executor.TiOpsExecutor, timeout int64) error
- func (i *TiFlashInstance) ScaleConfig(e executor.TiOpsExecutor, b Specification, ...) error
- func (i *TiFlashInstance) ServiceName() string
- func (i *TiFlashInstance) Status(pdList ...string) string
- func (i *TiFlashInstance) UsedDirs() []string
- func (i *TiFlashInstance) UsedPorts() []int
- func (i *TiFlashInstance) WaitForDown(e executor.TiOpsExecutor, timeout int64) error
- type TiFlashSpec
- type TiKVComponent
- type TiKVInstance
- func (i *TiKVInstance) Arch() string
- func (i *TiKVInstance) ComponentName() string
- func (i *TiKVInstance) DataDir() string
- func (i *TiKVInstance) DeployDir() string
- func (i *TiKVInstance) GetHost() string
- func (i *TiKVInstance) GetListenHost() string
- func (i *TiKVInstance) GetPort() int
- func (i *TiKVInstance) GetSSHPort() int
- func (i *TiKVInstance) ID() string
- func (i *TiKVInstance) InitConfig(e executor.TiOpsExecutor, clusterName, clusterVersion, deployUser string, ...) error
- func (i *TiKVInstance) InstanceName() string
- func (i *TiKVInstance) LogDir() string
- func (i *TiKVInstance) OS() string
- func (i *TiKVInstance) PrepareStart() error
- func (i *TiKVInstance) Ready(e executor.TiOpsExecutor, timeout int64) error
- func (i *TiKVInstance) ScaleConfig(e executor.TiOpsExecutor, b Specification, ...) error
- func (i *TiKVInstance) ServiceName() string
- func (i *TiKVInstance) Status(pdList ...string) string
- func (i *TiKVInstance) UsedDirs() []string
- func (i *TiKVInstance) UsedPorts() []int
- func (i *TiKVInstance) WaitForDown(e executor.TiOpsExecutor, timeout int64) error
- type TiKVSpec
Constants ¶
const ( // MetaFileName is the file name of the meta file. MetaFileName = "meta.yaml" // 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" )
const ( ComponentTiDB = "tidb" ComponentTiKV = "tikv" ComponentPD = "pd" ComponentTiFlash = "tiflash" ComponentGrafana = "grafana" ComponentDrainer = "drainer" ComponentPump = "pump" ComponentCDC = "cdc" ComponentAlertManager = "alertmanager" ComponentPrometheus = "prometheus" ComponentPushwaygate = "pushgateway" ComponentBlackboxExporter = "blackbox_exporter" ComponentNodeExporter = "node_exporter" ComponentCheckCollector = "insight" )
Components names supported by TiOps
const ( TiOpsPackageCacheDir = "packages" TiOpsClusterDir = "clusters" TiOpsAuditDir = "audit" )
sub directory names
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" )
Variables ¶
var ( // ErrClusterCreateDirFailed is ErrClusterCreateDirFailed ErrClusterCreateDirFailed = errNSCluster.NewType("create_dir_failed") // ErrClusterSaveMetaFailed is ErrClusterSaveMetaFailed ErrClusterSaveMetaFailed = errNSCluster.NewType("save_meta_failed") )
var (
RoleMonitor = "monitor"
)
general role names
var (
// ValidateErr is an empty validateErr object, useful for type checking
ValidateErr = &validateErr{}
)
Functions ¶
func AllComponentNames ¶
func AllComponentNames() (roles []string)
AllComponentNames contains the names of all components. should include all components in ComponentsByStartOrder
func ClusterPath ¶
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 ComponentVersion ¶
ComponentVersion maps the TiDB version to the third components binding version
func EnsureClusterDir ¶
EnsureClusterDir ensures that the cluster directory exists.
func HandleImportPathMigration ¶
HandleImportPathMigration tries to rename old configs file directory for imported clusters to the new name
func Initialize ¶
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 PortStarted ¶
func PortStarted(e executor.TiOpsExecutor, port int, timeout int64) error
PortStarted wait until a port is being listened
func PortStopped ¶
func PortStopped(e executor.TiOpsExecutor, 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 ¶
ProfilePath joins a path under the profile dir
func SaveClusterMeta ¶
func SaveClusterMeta(clusterName string, meta *ClusterMeta) error
SaveClusterMeta saves the cluster meta information to profile directory
Types ¶
type AlertManagerComponent ¶
type AlertManagerComponent struct{ *ClusterSpecification }
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) ComponentName ¶
func (i *AlertManagerInstance) ComponentName() string
ComponentName implements Instance interface
func (*AlertManagerInstance) GetHost ¶
func (i *AlertManagerInstance) GetHost() string
GetHost implements Instance interface
func (*AlertManagerInstance) GetListenHost ¶ added in v1.0.5
func (i *AlertManagerInstance) GetListenHost() string
GetListenHost implements Instance interface
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.TiOpsExecutor, clusterName, clusterVersion, deployUser string, paths DirPaths) error
InitConfig implement Instance interface
func (*AlertManagerInstance) InstanceName ¶
func (i *AlertManagerInstance) InstanceName() string
InstanceName implements Instance interface
func (*AlertManagerInstance) PrepareStart ¶
func (i *AlertManagerInstance) PrepareStart() error
PrepareStart checks instance requirements before starting
func (*AlertManagerInstance) Ready ¶
func (i *AlertManagerInstance) Ready(e executor.TiOpsExecutor, timeout int64) error
Ready implements Instance interface
func (*AlertManagerInstance) ScaleConfig ¶
func (i *AlertManagerInstance) ScaleConfig(e executor.TiOpsExecutor, b Specification, clusterName string, clusterVersion string, deployUser string, paths DirPaths) error
ScaleConfig deploy temporary config on scaling
func (*AlertManagerInstance) ServiceName ¶
func (i *AlertManagerInstance) ServiceName() string
ServiceName implements Instance interface
func (*AlertManagerInstance) WaitForDown ¶
func (i *AlertManagerInstance) WaitForDown(e executor.TiOpsExecutor, timeout int64) error
WaitForDown implements Instance interface
type AlertManagerSpec ¶
type AlertManagerSpec struct { Host string `yaml:"host"` SSHPort int `yaml:"ssh_port,omitempty"` 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"` ResourceControl ResourceControl `yaml:"resource_control,omitempty"` 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 CDCComponent ¶
type CDCComponent struct{ *ClusterSpecification }
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) ComponentName ¶
func (i *CDCInstance) ComponentName() string
ComponentName implements Instance interface
func (*CDCInstance) GetHost ¶
func (i *CDCInstance) GetHost() string
GetHost implements Instance interface
func (*CDCInstance) GetListenHost ¶ added in v1.0.5
func (i *CDCInstance) GetListenHost() string
GetListenHost implements Instance interface
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.TiOpsExecutor, clusterName, clusterVersion, deployUser string, paths DirPaths) error
InitConfig implements Instance interface.
func (*CDCInstance) InstanceName ¶
func (i *CDCInstance) InstanceName() string
InstanceName implements Instance interface
func (*CDCInstance) PrepareStart ¶
func (i *CDCInstance) PrepareStart() error
PrepareStart checks instance requirements before starting
func (*CDCInstance) Ready ¶
func (i *CDCInstance) Ready(e executor.TiOpsExecutor, timeout int64) error
Ready implements Instance interface
func (*CDCInstance) ScaleConfig ¶
func (i *CDCInstance) ScaleConfig(e executor.TiOpsExecutor, b Specification, clusterName, clusterVersion, user string, paths DirPaths) error
ScaleConfig deploy temporary config on scaling
func (*CDCInstance) ServiceName ¶
func (i *CDCInstance) ServiceName() string
ServiceName implements Instance interface
func (*CDCInstance) WaitForDown ¶
func (i *CDCInstance) WaitForDown(e executor.TiOpsExecutor, timeout int64) error
WaitForDown implements Instance interface
type CDCSpec ¶
type CDCSpec struct { Host string `yaml:"host"` SSHPort int `yaml:"ssh_port,omitempty"` 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"` Config map[string]interface{} `yaml:"config,omitempty"` ResourceControl ResourceControl `yaml:"resource_control,omitempty"` Arch string `yaml:"arch,omitempty"` OS string `yaml:"os,omitempty"` }
CDCSpec represents the Drainer topology specification in topology.yaml
func (CDCSpec) GetMainPort ¶
GetMainPort returns the main port of the instance
func (CDCSpec) IsImported ¶
IsImported returns if the node is imported from TiDB-Ansible
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 *ClusterSpecification `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
type ClusterSpecification ¶
type ClusterSpecification struct { GlobalOptions GlobalOptions `yaml:"global,omitempty"` MonitoredOptions MonitoredOptions `yaml:"monitored,omitempty"` ServerConfigs ServerConfigs `yaml:"server_configs,omitempty"` 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"` Monitors []PrometheusSpec `yaml:"monitoring_servers"` Grafana []GrafanaSpec `yaml:"grafana_servers,omitempty"` Alertmanager []AlertManagerSpec `yaml:"alertmanager_servers,omitempty"` }
ClusterSpecification represents the specification of topology.yaml
func (*ClusterSpecification) AlertManagerEndpoints ¶
func (topo *ClusterSpecification) AlertManagerEndpoints(user string) []*scripts.AlertManagerScript
AlertManagerEndpoints returns the AlertManager endpoints configurations
func (*ClusterSpecification) ComponentsByStartOrder ¶
func (topo *ClusterSpecification) ComponentsByStartOrder() (comps []Component)
ComponentsByStartOrder return component in the order need to start.
func (*ClusterSpecification) ComponentsByStopOrder ¶
func (topo *ClusterSpecification) ComponentsByStopOrder() (comps []Component)
ComponentsByStopOrder return component in the order need to stop.
func (*ClusterSpecification) ComponentsByUpdateOrder ¶
func (topo *ClusterSpecification) ComponentsByUpdateOrder() (comps []Component)
ComponentsByUpdateOrder return component in the order need to be updated.
func (*ClusterSpecification) CountDir ¶ added in v1.0.6
func (topo *ClusterSpecification) 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 (*ClusterSpecification) Endpoints ¶
func (topo *ClusterSpecification) Endpoints(user string) []*scripts.PDScript
Endpoints returns the PD endpoints configurations
func (*ClusterSpecification) GetClusterSpecification ¶
func (topo *ClusterSpecification) GetClusterSpecification() *ClusterSpecification
GetClusterSpecification returns cluster topology
func (*ClusterSpecification) GetEtcdClient ¶ added in v1.0.6
func (topo *ClusterSpecification) GetEtcdClient() (*clientv3.Client, error)
GetEtcdClient load EtcdClient of current cluster
func (*ClusterSpecification) GetGlobalOptions ¶
func (topo *ClusterSpecification) GetGlobalOptions() GlobalOptions
GetGlobalOptions returns GlobalOptions
func (*ClusterSpecification) GetMonitoredOptions ¶
func (topo *ClusterSpecification) GetMonitoredOptions() MonitoredOptions
GetMonitoredOptions returns MonitoredOptions
func (*ClusterSpecification) GetPDList ¶ added in v1.0.6
func (topo *ClusterSpecification) GetPDList() []string
GetPDList returns a list of PD API hosts of the current cluster
func (*ClusterSpecification) IterComponent ¶
func (topo *ClusterSpecification) IterComponent(fn func(comp Component))
IterComponent iterates all components in component starting order
func (*ClusterSpecification) IterHost ¶
func (topo *ClusterSpecification) IterHost(fn func(instance Instance))
IterHost iterates one instance for each host
func (*ClusterSpecification) IterInstance ¶
func (topo *ClusterSpecification) IterInstance(fn func(instance Instance))
IterInstance iterates all instances in component starting order
func (*ClusterSpecification) Merge ¶ added in v1.0.6
func (topo *ClusterSpecification) Merge(that *ClusterSpecification) *ClusterSpecification
Merge returns a new ClusterSpecification which sum old ones
func (*ClusterSpecification) UnmarshalYAML ¶ added in v1.0.6
func (topo *ClusterSpecification) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML sets default values when unmarshaling the topology file
func (*ClusterSpecification) Validate ¶ added in v1.0.6
func (topo *ClusterSpecification) Validate() error
Validate validates the topology specification and produce error if the specification invalid (e.g: port conflicts or directory conflicts)
type DrainerComponent ¶
type DrainerComponent struct{ *ClusterSpecification }
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) ComponentName ¶
func (i *DrainerInstance) ComponentName() string
ComponentName implements Instance interface
func (*DrainerInstance) GetHost ¶
func (i *DrainerInstance) GetHost() string
GetHost implements Instance interface
func (*DrainerInstance) GetListenHost ¶ added in v1.0.5
func (i *DrainerInstance) GetListenHost() string
GetListenHost implements Instance interface
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.TiOpsExecutor, clusterName, clusterVersion, deployUser string, paths DirPaths) error
InitConfig implements Instance interface.
func (*DrainerInstance) InstanceName ¶
func (i *DrainerInstance) InstanceName() string
InstanceName implements Instance interface
func (*DrainerInstance) PrepareStart ¶
func (i *DrainerInstance) PrepareStart() error
PrepareStart checks instance requirements before starting
func (*DrainerInstance) Ready ¶
func (i *DrainerInstance) Ready(e executor.TiOpsExecutor, timeout int64) error
Ready implements Instance interface
func (*DrainerInstance) ScaleConfig ¶
func (i *DrainerInstance) ScaleConfig(e executor.TiOpsExecutor, b Specification, clusterName, clusterVersion, user string, paths DirPaths) error
ScaleConfig deploy temporary config on scaling
func (*DrainerInstance) ServiceName ¶
func (i *DrainerInstance) ServiceName() string
ServiceName implements Instance interface
func (*DrainerInstance) WaitForDown ¶
func (i *DrainerInstance) WaitForDown(e executor.TiOpsExecutor, timeout int64) error
WaitForDown implements Instance interface
type DrainerSpec ¶
type DrainerSpec struct { Host string `yaml:"host"` SSHPort int `yaml:"ssh_port,omitempty"` 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"` Config map[string]interface{} `yaml:"config,omitempty"` ResourceControl ResourceControl `yaml:"resource_control,omitempty"` 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"` DeployDir string `yaml:"deploy_dir,omitempty" default:"deploy"` DataDir string `yaml:"data_dir,omitempty" default:"data"` LogDir string `yaml:"log_dir,omitempty"` ResourceControl ResourceControl `yaml:"resource_control,omitempty"` 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{ *ClusterSpecification }
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) ComponentName ¶
func (i *GrafanaInstance) ComponentName() string
ComponentName implements Instance interface
func (*GrafanaInstance) GetHost ¶
func (i *GrafanaInstance) GetHost() string
GetHost implements Instance interface
func (*GrafanaInstance) GetListenHost ¶ added in v1.0.5
func (i *GrafanaInstance) GetListenHost() string
GetListenHost implements Instance interface
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.TiOpsExecutor, clusterName, clusterVersion, deployUser string, paths DirPaths) error
InitConfig implement Instance interface
func (*GrafanaInstance) InstanceName ¶
func (i *GrafanaInstance) InstanceName() string
InstanceName implements Instance interface
func (*GrafanaInstance) PrepareStart ¶
func (i *GrafanaInstance) PrepareStart() error
PrepareStart checks instance requirements before starting
func (*GrafanaInstance) Ready ¶
func (i *GrafanaInstance) Ready(e executor.TiOpsExecutor, timeout int64) error
Ready implements Instance interface
func (*GrafanaInstance) ScaleConfig ¶
func (i *GrafanaInstance) ScaleConfig(e executor.TiOpsExecutor, b Specification, clusterName string, clusterVersion string, deployUser string, paths DirPaths) error
ScaleConfig deploy temporary config on scaling
func (*GrafanaInstance) ServiceName ¶
func (i *GrafanaInstance) ServiceName() string
ServiceName implements Instance interface
func (*GrafanaInstance) WaitForDown ¶
func (i *GrafanaInstance) WaitForDown(e executor.TiOpsExecutor, timeout int64) error
WaitForDown implements Instance interface
type GrafanaSpec ¶
type GrafanaSpec struct { Host string `yaml:"host"` SSHPort int `yaml:"ssh_port,omitempty"` Imported bool `yaml:"imported,omitempty"` Port int `yaml:"port" default:"3000"` DeployDir string `yaml:"deploy_dir,omitempty"` ResourceControl ResourceControl `yaml:"resource_control,omitempty"` 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.TiOpsExecutor, int64) error WaitForDown(executor.TiOpsExecutor, int64) error InitConfig(e executor.TiOpsExecutor, clusterName string, clusterVersion string, deployUser string, paths DirPaths) error ScaleConfig(e executor.TiOpsExecutor, topo Specification, clusterName string, clusterVersion string, deployUser string, paths 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 MonitorComponent ¶
type MonitorComponent struct{ *ClusterSpecification }
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) ComponentName ¶
func (i *MonitorInstance) ComponentName() string
ComponentName implements Instance interface
func (*MonitorInstance) GetHost ¶
func (i *MonitorInstance) GetHost() string
GetHost implements Instance interface
func (*MonitorInstance) GetListenHost ¶ added in v1.0.5
func (i *MonitorInstance) GetListenHost() string
GetListenHost implements Instance interface
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.TiOpsExecutor, clusterName, clusterVersion, deployUser string, paths DirPaths) error
InitConfig implement Instance interface
func (*MonitorInstance) InstanceName ¶
func (i *MonitorInstance) InstanceName() string
InstanceName implements Instance interface
func (*MonitorInstance) PrepareStart ¶
func (i *MonitorInstance) PrepareStart() error
PrepareStart checks instance requirements before starting
func (*MonitorInstance) Ready ¶
func (i *MonitorInstance) Ready(e executor.TiOpsExecutor, timeout int64) error
Ready implements Instance interface
func (*MonitorInstance) ScaleConfig ¶
func (i *MonitorInstance) ScaleConfig(e executor.TiOpsExecutor, b Specification, clusterName string, clusterVersion string, deployUser string, paths DirPaths) error
ScaleConfig deploy temporary config on scaling
func (*MonitorInstance) ServiceName ¶
func (i *MonitorInstance) ServiceName() string
ServiceName implements Instance interface
func (*MonitorInstance) WaitForDown ¶
func (i *MonitorInstance) WaitForDown(e executor.TiOpsExecutor, 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"` ResourceControl ResourceControl `yaml:"resource_control,omitempty"` }
MonitoredOptions represents the monitored node configuration
type PDComponent ¶
type PDComponent struct{ *ClusterSpecification }
PDComponent represents PD component.
func (*PDComponent) Instances ¶
func (c *PDComponent) Instances() []Instance
Instances implements Component interface.
type PDInstance ¶
type PDInstance struct { Name string // contains filtered or unexported fields }
PDInstance represent the PD instance
func (*PDInstance) ComponentName ¶
func (i *PDInstance) ComponentName() string
ComponentName implements Instance interface
func (*PDInstance) GetHost ¶
func (i *PDInstance) GetHost() string
GetHost implements Instance interface
func (*PDInstance) GetListenHost ¶ added in v1.0.5
func (i *PDInstance) GetListenHost() string
GetListenHost implements Instance interface
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.TiOpsExecutor, clusterName, clusterVersion, deployUser string, paths DirPaths) error
InitConfig implement Instance interface
func (*PDInstance) InstanceName ¶
func (i *PDInstance) InstanceName() string
InstanceName implements Instance interface
func (*PDInstance) PrepareStart ¶
func (i *PDInstance) PrepareStart() error
PrepareStart checks instance requirements before starting
func (*PDInstance) Ready ¶
func (i *PDInstance) Ready(e executor.TiOpsExecutor, timeout int64) error
Ready implements Instance interface
func (*PDInstance) ScaleConfig ¶
func (i *PDInstance) ScaleConfig(e executor.TiOpsExecutor, b Specification, clusterName, clusterVersion, deployUser string, paths DirPaths) error
ScaleConfig deploy temporary config on scaling
func (*PDInstance) ServiceName ¶
func (i *PDInstance) ServiceName() string
ServiceName implements Instance interface
func (*PDInstance) WaitForDown ¶
func (i *PDInstance) WaitForDown(e executor.TiOpsExecutor, 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"` 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"` Config map[string]interface{} `yaml:"config,omitempty"` ResourceControl ResourceControl `yaml:"resource_control,omitempty"` Arch string `yaml:"arch,omitempty"` OS string `yaml:"os,omitempty"` }
PDSpec represents the PD topology specification in topology.yaml
func (PDSpec) GetMainPort ¶
GetMainPort returns the main port of the instance
func (PDSpec) IsImported ¶
IsImported returns if the node is imported from TiDB-Ansible
type PrometheusSpec ¶
type PrometheusSpec struct { Host string `yaml:"host"` SSHPort int `yaml:"ssh_port,omitempty"` 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"` Retention string `yaml:"storage_retention,omitempty"` ResourceControl ResourceControl `yaml:"resource_control,omitempty"` 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{ *ClusterSpecification }
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) ComponentName ¶
func (i *PumpInstance) ComponentName() string
ComponentName implements Instance interface
func (*PumpInstance) GetHost ¶
func (i *PumpInstance) GetHost() string
GetHost implements Instance interface
func (*PumpInstance) GetListenHost ¶ added in v1.0.5
func (i *PumpInstance) GetListenHost() string
GetListenHost implements Instance interface
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.TiOpsExecutor, clusterName, clusterVersion, deployUser string, paths DirPaths) error
InitConfig implements Instance interface.
func (*PumpInstance) InstanceName ¶
func (i *PumpInstance) InstanceName() string
InstanceName implements Instance interface
func (*PumpInstance) PrepareStart ¶
func (i *PumpInstance) PrepareStart() error
PrepareStart checks instance requirements before starting
func (*PumpInstance) Ready ¶
func (i *PumpInstance) Ready(e executor.TiOpsExecutor, timeout int64) error
Ready implements Instance interface
func (*PumpInstance) ScaleConfig ¶
func (i *PumpInstance) ScaleConfig(e executor.TiOpsExecutor, b Specification, clusterName, clusterVersion, deployUser string, paths DirPaths) error
ScaleConfig deploy temporary config on scaling
func (*PumpInstance) ServiceName ¶
func (i *PumpInstance) ServiceName() string
ServiceName implements Instance interface
func (*PumpInstance) WaitForDown ¶
func (i *PumpInstance) WaitForDown(e executor.TiOpsExecutor, timeout int64) error
WaitForDown implements Instance interface
type PumpSpec ¶
type PumpSpec struct { Host string `yaml:"host"` SSHPort int `yaml:"ssh_port,omitempty"` 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"` Config map[string]interface{} `yaml:"config,omitempty"` ResourceControl ResourceControl `yaml:"resource_control"` Arch string `yaml:"arch,omitempty"` OS string `yaml:"os,omitempty"` }
PumpSpec represents the Pump topology specification in topology.yaml
func (PumpSpec) GetMainPort ¶
GetMainPort returns the main port of the instance
func (PumpSpec) IsImported ¶
IsImported returns if the node is imported from TiDB-Ansible
type ResourceControl ¶
type ResourceControl struct { MemoryLimit string `yaml:"memory_limit,omitempty"` CPUQuota string `yaml:"cpu_quota,omitempty"` IOReadBandwidthMax string `yaml:"io_read_bandwidth_max,omitempty"` IOWriteBandwidthMax string `yaml:"io_write_bandwidth_max,omitempty"` }
ResourceControl is used to control the system resource See: https://www.freedesktop.org/software/systemd/man/systemd.resource-control.html
func MergeResourceControl ¶
func MergeResourceControl(lhs, rhs ResourceControl) ResourceControl
MergeResourceControl merge the rhs into lhs and overwrite rhs if lhs has value for same field
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 Specification ¶
type Specification interface { ComponentsByStopOrder() (comps []Component) ComponentsByStartOrder() (comps []Component) ComponentsByUpdateOrder() (comps []Component) IterComponent(fn func(comp Component)) IterInstance(fn func(instance Instance)) IterHost(fn func(instance Instance)) GetGlobalOptions() GlobalOptions GetMonitoredOptions() MonitoredOptions GetClusterSpecification() *ClusterSpecification }
Specification represents the topology of cluster/dm
type TiDBComponent ¶
type TiDBComponent struct{ *ClusterSpecification }
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) ComponentName ¶
func (i *TiDBInstance) ComponentName() string
ComponentName implements Instance interface
func (*TiDBInstance) GetHost ¶
func (i *TiDBInstance) GetHost() string
GetHost implements Instance interface
func (*TiDBInstance) GetListenHost ¶ added in v1.0.5
func (i *TiDBInstance) GetListenHost() string
GetListenHost implements Instance interface
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.TiOpsExecutor, clusterName, clusterVersion, deployUser string, paths DirPaths) error
InitConfig implement Instance interface
func (*TiDBInstance) InstanceName ¶
func (i *TiDBInstance) InstanceName() string
InstanceName implements Instance interface
func (*TiDBInstance) PrepareStart ¶
func (i *TiDBInstance) PrepareStart() error
PrepareStart checks instance requirements before starting
func (*TiDBInstance) Ready ¶
func (i *TiDBInstance) Ready(e executor.TiOpsExecutor, timeout int64) error
Ready implements Instance interface
func (*TiDBInstance) ScaleConfig ¶
func (i *TiDBInstance) ScaleConfig(e executor.TiOpsExecutor, b Specification, clusterName, clusterVersion, deployUser string, paths DirPaths) error
ScaleConfig deploy temporary config on scaling
func (*TiDBInstance) ServiceName ¶
func (i *TiDBInstance) ServiceName() string
ServiceName implements Instance interface
func (*TiDBInstance) WaitForDown ¶
func (i *TiDBInstance) WaitForDown(e executor.TiOpsExecutor, 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"` 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"` Config map[string]interface{} `yaml:"config,omitempty"` ResourceControl ResourceControl `yaml:"resource_control,omitempty"` Arch string `yaml:"arch,omitempty"` OS string `yaml:"os,omitempty"` }
TiDBSpec represents the TiDB topology specification in topology.yaml
func (TiDBSpec) GetMainPort ¶
GetMainPort returns the main port of the instance
func (TiDBSpec) IsImported ¶
IsImported returns if the node is imported from TiDB-Ansible
type TiFlashComponent ¶
type TiFlashComponent struct{ *ClusterSpecification }
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) 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) GetHost ¶
func (i *TiFlashInstance) GetHost() string
GetHost implements Instance interface
func (*TiFlashInstance) GetListenHost ¶ added in v1.0.5
func (i *TiFlashInstance) GetListenHost() string
GetListenHost implements Instance interface
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.TiOpsExecutor, clusterName, clusterVersion, deployUser string, paths 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) PrepareStart ¶
func (i *TiFlashInstance) PrepareStart() error
PrepareStart checks TiFlash requirements before starting
func (*TiFlashInstance) Ready ¶
func (i *TiFlashInstance) Ready(e executor.TiOpsExecutor, timeout int64) error
Ready implements Instance interface
func (*TiFlashInstance) ScaleConfig ¶
func (i *TiFlashInstance) ScaleConfig(e executor.TiOpsExecutor, b Specification, clusterName, clusterVersion, deployUser string, paths DirPaths) error
ScaleConfig deploy temporary config on scaling
func (*TiFlashInstance) ServiceName ¶
func (i *TiFlashInstance) ServiceName() string
ServiceName implements Instance interface
func (*TiFlashInstance) WaitForDown ¶
func (i *TiFlashInstance) WaitForDown(e executor.TiOpsExecutor, timeout int64) error
WaitForDown implements Instance interface
type TiFlashSpec ¶
type TiFlashSpec struct { Host string `yaml:"host"` SSHPort int `yaml:"ssh_port,omitempty"` 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"` Config map[string]interface{} `yaml:"config,omitempty"` LearnerConfig map[string]interface{} `yaml:"learner_config,omitempty"` ResourceControl ResourceControl `yaml:"resource_control,omitempty"` 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 {
*ClusterSpecification
}
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) ComponentName ¶
func (i *TiKVInstance) ComponentName() string
ComponentName implements Instance interface
func (*TiKVInstance) GetHost ¶
func (i *TiKVInstance) GetHost() string
GetHost implements Instance interface
func (*TiKVInstance) GetListenHost ¶ added in v1.0.5
func (i *TiKVInstance) GetListenHost() string
GetListenHost implements Instance interface
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.TiOpsExecutor, clusterName, clusterVersion, deployUser string, paths DirPaths) error
InitConfig implement Instance interface
func (*TiKVInstance) InstanceName ¶
func (i *TiKVInstance) InstanceName() string
InstanceName implements Instance interface
func (*TiKVInstance) PrepareStart ¶
func (i *TiKVInstance) PrepareStart() error
PrepareStart checks instance requirements before starting
func (*TiKVInstance) Ready ¶
func (i *TiKVInstance) Ready(e executor.TiOpsExecutor, timeout int64) error
Ready implements Instance interface
func (*TiKVInstance) ScaleConfig ¶
func (i *TiKVInstance) ScaleConfig(e executor.TiOpsExecutor, b Specification, clusterName, clusterVersion, deployUser string, paths DirPaths) error
ScaleConfig deploy temporary config on scaling
func (*TiKVInstance) ServiceName ¶
func (i *TiKVInstance) ServiceName() string
ServiceName implements Instance interface
func (*TiKVInstance) WaitForDown ¶
func (i *TiKVInstance) WaitForDown(e executor.TiOpsExecutor, 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"` 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"` Config map[string]interface{} `yaml:"config,omitempty"` ResourceControl ResourceControl `yaml:"resource_control,omitempty"` Arch string `yaml:"arch,omitempty"` OS string `yaml:"os,omitempty"` }
TiKVSpec represents the TiKV topology specification in topology.yaml
func (TiKVSpec) GetMainPort ¶
GetMainPort returns the main port of the instance
func (TiKVSpec) IsImported ¶
IsImported returns if the node is imported from TiDB-Ansible