Documentation ¶
Index ¶
- Constants
- Variables
- func AlertManagerEndpoints(alertmanager []AlertManagerSpec, user string) []*scripts.AlertManagerScript
- func AllComponentNames() (roles []string)
- func AuditDir() string
- func CheckClusterDirConflict(clusterList map[string]Metadata, clusterName string, topo Topology) error
- func CheckClusterPortConflict(clusterList map[string]Metadata, clusterName string, topo Topology) error
- func ClusterPath(cluster string, subpath ...string) string
- func ComponentSubDir(comp, version string) string
- func HandleImportPathMigration(clsName string) error
- func Initialize(base string) error
- func IterHost(topo Topology, fn func(instance Instance))
- func Merge2Toml(comp string, global, overwrite map[string]interface{}) ([]byte, error)
- func MergeResourceControl(lhs, rhs meta.ResourceControl) meta.ResourceControl
- func PortStarted(e executor.Executor, port int, timeout int64) error
- func PortStopped(e executor.Executor, port int, timeout int64) error
- func ProfileDir() string
- func ProfilePath(subpath ...string) string
- func RelativePathDetect(topo interface{}, isSkipField func(reflect.Value) bool) error
- func SaveClusterMeta(clusterName string, cmeta *ClusterMeta) error
- func TiDBComponentVersion(comp, version string) string
- type AlertManagerComponent
- type AlertManagerInstance
- type AlertManagerSpec
- type BaseInstance
- func (i *BaseInstance) Arch() string
- func (i *BaseInstance) ComponentName() string
- func (i *BaseInstance) DataDir() string
- func (i *BaseInstance) DeployDir() string
- func (i *BaseInstance) GetHost() string
- func (i *BaseInstance) GetListenHost() string
- func (i *BaseInstance) GetPort() int
- func (i *BaseInstance) GetSSHPort() int
- func (i *BaseInstance) ID() string
- func (i *BaseInstance) InitConfig(e executor.Executor, opt GlobalOptions, user string, paths meta.DirPaths) error
- func (i *BaseInstance) InstanceName() string
- func (i *BaseInstance) LogDir() string
- func (i *BaseInstance) MergeServerConfig(e executor.Executor, globalConf, instanceConf map[string]interface{}, ...) error
- func (i *BaseInstance) OS() string
- func (i *BaseInstance) PrepareStart() error
- func (i *BaseInstance) Ready(e executor.Executor, timeout int64) error
- func (i *BaseInstance) ServiceName() string
- func (i *BaseInstance) Status(pdList ...string) string
- func (i *BaseInstance) TransferLocalConfigDir(e executor.Executor, local, remote string, filter func(string) bool) error
- func (i *BaseInstance) TransferLocalConfigFile(e executor.Executor, local, remote string) error
- func (i *BaseInstance) UsedDirs() []string
- func (i *BaseInstance) UsedPorts() []int
- type BaseMeta
- type BaseTopo
- type BindVersion
- type CDCComponent
- type CDCInstance
- type CDCSpec
- type ClusterMeta
- type Component
- type DrainerComponent
- type DrainerInstance
- type DrainerSpec
- type GlobalOptions
- type GrafanaComponent
- type GrafanaInstance
- type GrafanaSpec
- type Instance
- type InstanceSpec
- type Metadata
- type MonitorComponent
- type MonitorInstance
- type MonitoredOptions
- type PDComponent
- type PDInstance
- func (i *PDInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, ...) error
- func (i *PDInstance) PostRestart(topo Topology) error
- func (i *PDInstance) PreRestart(topo Topology, apiTimeoutSeconds int) error
- func (i *PDInstance) ScaleConfig(e executor.Executor, topo Topology, ...) error
- type PDSpec
- type PrometheusSpec
- type PumpComponent
- type PumpInstance
- type PumpSpec
- type RollingUpdateInstance
- type ScaleOutTopology
- type ServerConfigs
- type SpecManager
- func (s *SpecManager) Exist(name string) (exist bool, err error)
- func (s *SpecManager) GetAllClusters() (map[string]Metadata, error)
- func (s *SpecManager) List() (names []string, err error)
- func (s *SpecManager) Metadata(clusterName string, meta interface{}) error
- func (s *SpecManager) NewMetadata() Metadata
- func (s *SpecManager) Path(cluster string, subpath ...string) string
- func (s *SpecManager) Remove(name string) error
- func (s *SpecManager) SaveMeta(clusterName string, meta Metadata) error
- type Specification
- func (s *Specification) BaseTopo() *BaseTopo
- func (s *Specification) ComponentsByStartOrder() (comps []Component)
- func (s *Specification) ComponentsByStopOrder() (comps []Component)
- func (s *Specification) ComponentsByUpdateOrder() (comps []Component)
- func (s *Specification) CountDir(targetHost, dirPrefix string) int
- func (s *Specification) Endpoints(user string) []*scripts.PDScript
- func (s *Specification) GetEtcdClient() (*clientv3.Client, error)
- func (s *Specification) GetMonitoredOptions() *MonitoredOptions
- func (s *Specification) GetPDList() []string
- func (s *Specification) IterComponent(fn func(comp Component))
- func (s *Specification) IterInstance(fn func(instance Instance))
- func (s *Specification) Merge(that *Specification) *Specification
- func (s *Specification) MergeTopo(topo Topology) Topology
- func (s *Specification) NewPart() Topology
- func (s *Specification) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (s *Specification) Validate() error
- type TiDBComponent
- type TiDBInstance
- type TiDBSpec
- type TiFlashComponent
- type TiFlashInstance
- func (i *TiFlashInstance) DataDir() string
- func (i *TiFlashInstance) GetServicePort() int
- func (i *TiFlashInstance) InitConfig(e executor.Executor, 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, clusterVersion string, src map[string]interface{}) (map[string]interface{}, error)
- func (i *TiFlashInstance) PrepareStart() error
- func (i *TiFlashInstance) ScaleConfig(e executor.Executor, topo Topology, ...) error
- type TiFlashSpec
- type TiKVComponent
- type TiKVInstance
- func (i *TiKVInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, ...) error
- func (i *TiKVInstance) PostRestart(topo Topology) error
- func (i *TiKVInstance) PreRestart(topo Topology, apiTimeoutSeconds int) error
- func (i *TiKVInstance) ScaleConfig(e executor.Executor, topo Topology, ...) error
- type TiKVSpec
- type TiSparkMasterComponent
- type TiSparkMasterInstance
- func (i *TiSparkMasterInstance) GetCustomEnvs() map[string]string
- func (i *TiSparkMasterInstance) GetCustomFields() map[string]interface{}
- func (i *TiSparkMasterInstance) GetJavaHome() string
- func (i *TiSparkMasterInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, ...) error
- func (i *TiSparkMasterInstance) ScaleConfig(e executor.Executor, topo Topology, ...) error
- type TiSparkMasterSpec
- type TiSparkWorkerComponent
- type TiSparkWorkerInstance
- type TiSparkWorkerSpec
- type Topology
- type UpgradableMetadata
Constants ¶
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
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" )
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 ¶
var ( RoleMonitor = "monitor" RoleTiSparkMaster = "tispark-master" RoleTiSparkWorker = "tispark-worker" )
general role names
var ( // ErrCreateDirFailed is ErrCreateDirFailed ErrCreateDirFailed = errNS.NewType("create_dir_failed") // ErrSaveMetaFailed is ErrSaveMetaFailed ErrSaveMetaFailed = errNS.NewType("save_meta_failed") )
var ( 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") )
pre defined error types
var ErrorCheckConfig = errors.New("check config failed")
ErrorCheckConfig represent error occured in config check stage
Functions ¶
func AlertManagerEndpoints ¶ added in v1.1.0
func AlertManagerEndpoints(alertmanager []AlertManagerSpec, user string) []*scripts.AlertManagerScript
AlertManagerEndpoints returns the AlertManager endpoints configurations
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 CheckClusterDirConflict ¶ added in v1.1.0
func CheckClusterDirConflict(clusterList map[string]Metadata, clusterName string, topo Topology) error
CheckClusterDirConflict checks cluster dir conflict
func CheckClusterPortConflict ¶ added in v1.1.0
func CheckClusterPortConflict(clusterList map[string]Metadata, clusterName string, topo Topology) error
CheckClusterPortConflict checks cluster dir conflict
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 ComponentSubDir ¶ added in v1.0.9
ComponentSubDir maps a component with version to a subdir if needed
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 Merge2Toml ¶ added in v1.0.8
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 ¶
PortStarted wait until a port is being listened
func PortStopped ¶
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 RelativePathDetect ¶ added in v1.1.0
RelativePathDetect detect if some specific path is relative path and report error
func SaveClusterMeta ¶
func SaveClusterMeta(clusterName string, cmeta *ClusterMeta) error
SaveClusterMeta saves the cluster meta information to profile directory
func TiDBComponentVersion ¶ added in v1.1.0
TiDBComponentVersion maps the TiDB version to the third components binding version
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.
func (*AlertManagerComponent) Role ¶ added in v1.1.0
func (c *AlertManagerComponent) Role() string
Role implements Component interface.
type AlertManagerInstance ¶
type AlertManagerInstance struct { BaseInstance // contains filtered or unexported fields }
AlertManagerInstance represent the alert manager instance
func (*AlertManagerInstance) InitConfig ¶
func (i *AlertManagerInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error
InitConfig implement 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"` ConfigFilePath string `yaml:"config_file,omitempty" validate:"config_file:editable"` }
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 BaseInstance ¶ added in v1.1.0
type BaseInstance struct { InstanceSpec Name string Host string ListenHost string Port int SSHP int Ports []int Dirs []string StatusFn func(pdHosts ...string) string }
BaseInstance implements some method of Instance interface..
func (*BaseInstance) Arch ¶ added in v1.1.0
func (i *BaseInstance) Arch() string
Arch implements Instance interface
func (*BaseInstance) ComponentName ¶ added in v1.1.0
func (i *BaseInstance) ComponentName() string
ComponentName implements Instance interface
func (*BaseInstance) DataDir ¶ added in v1.1.0
func (i *BaseInstance) DataDir() string
DataDir implements Instance interface
func (*BaseInstance) DeployDir ¶ added in v1.1.0
func (i *BaseInstance) DeployDir() string
DeployDir implements Instance interface
func (*BaseInstance) GetHost ¶ added in v1.1.0
func (i *BaseInstance) GetHost() string
GetHost implements Instance interface
func (*BaseInstance) GetListenHost ¶ added in v1.1.0
func (i *BaseInstance) GetListenHost() string
GetListenHost implements Instance interface
func (*BaseInstance) GetPort ¶ added in v1.1.0
func (i *BaseInstance) GetPort() int
GetPort implements Instance interface
func (*BaseInstance) GetSSHPort ¶ added in v1.1.0
func (i *BaseInstance) GetSSHPort() int
GetSSHPort implements Instance interface
func (*BaseInstance) ID ¶ added in v1.1.0
func (i *BaseInstance) ID() string
ID returns the identifier of this instance, the ID is constructed by host:port
func (*BaseInstance) InitConfig ¶ added in v1.1.0
func (i *BaseInstance) InitConfig(e executor.Executor, opt GlobalOptions, user string, paths meta.DirPaths) error
InitConfig init the service configuration.
func (*BaseInstance) InstanceName ¶ added in v1.1.0
func (i *BaseInstance) InstanceName() string
InstanceName implements Instance interface
func (*BaseInstance) LogDir ¶ added in v1.1.0
func (i *BaseInstance) LogDir() string
LogDir implements Instance interface
func (*BaseInstance) MergeServerConfig ¶ added in v1.1.0
func (i *BaseInstance) MergeServerConfig(e executor.Executor, globalConf, instanceConf map[string]interface{}, paths meta.DirPaths) error
MergeServerConfig merges the server configuration and overwrite the global configuration
func (*BaseInstance) OS ¶ added in v1.1.0
func (i *BaseInstance) OS() string
OS implements Instance interface
func (*BaseInstance) PrepareStart ¶ added in v1.1.0
func (i *BaseInstance) PrepareStart() error
PrepareStart checks instance requirements before starting
func (*BaseInstance) Ready ¶ added in v1.1.0
func (i *BaseInstance) Ready(e executor.Executor, timeout int64) error
Ready implements Instance interface
func (*BaseInstance) ServiceName ¶ added in v1.1.0
func (i *BaseInstance) ServiceName() string
ServiceName implements Instance interface
func (*BaseInstance) Status ¶ added in v1.1.0
func (i *BaseInstance) Status(pdList ...string) string
Status implements Instance interface
func (*BaseInstance) TransferLocalConfigDir ¶ added in v1.1.0
func (i *BaseInstance) TransferLocalConfigDir(e executor.Executor, local, remote string, filter func(string) bool) error
TransferLocalConfigDir scp local config directory to remote Precondition: the user on remote have right to access & mkdir of dest files
func (*BaseInstance) TransferLocalConfigFile ¶ added in v1.1.0
func (i *BaseInstance) TransferLocalConfigFile(e executor.Executor, local, remote string) error
TransferLocalConfigFile scp local config file to remote Precondition: the user on remote have permission to access & mkdir of dest files
func (*BaseInstance) UsedDirs ¶ added in v1.1.0
func (i *BaseInstance) UsedDirs() []string
UsedDirs implements Instance interface
func (*BaseInstance) UsedPorts ¶ added in v1.1.0
func (i *BaseInstance) UsedPorts() []int
UsedPorts implements Instance interface
type BaseMeta ¶ added in v1.0.9
type BaseMeta struct { User string Group 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 BindVersion ¶ added in v1.1.0
BindVersion map the cluster version to the third components binding version.
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.
func (*CDCComponent) Role ¶ added in v1.1.0
func (c *CDCComponent) Role() string
Role implements Component interface.
type CDCInstance ¶
type CDCInstance struct { BaseInstance // contains filtered or unexported fields }
CDCInstance represent the CDC instance.
func (*CDCInstance) InitConfig ¶
func (i *CDCInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error
InitConfig 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
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 ¶
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 *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 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.
func (*DrainerComponent) Role ¶ added in v1.1.0
func (c *DrainerComponent) Role() string
Role implements Component interface.
type DrainerInstance ¶
type DrainerInstance struct { BaseInstance // contains filtered or unexported fields }
DrainerInstance represent the Drainer instance.
func (*DrainerInstance) InitConfig ¶
func (i *DrainerInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error
InitConfig 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
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"` Group string `yaml:"group,omitempty"` 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.
func (*GrafanaComponent) Role ¶ added in v1.1.0
func (c *GrafanaComponent) Role() string
Role implements Component interface.
type GrafanaInstance ¶
type GrafanaInstance struct { BaseInstance // contains filtered or unexported fields }
GrafanaInstance represent the grafana instance
func (*GrafanaInstance) InitConfig ¶
func (i *GrafanaInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error
InitConfig implement 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"` DashboardDir string `yaml:"dashboard_dir,omitempty" validate:"dashboard_dir:editable"` }
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 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.
func (*MonitorComponent) Role ¶ added in v1.1.0
func (c *MonitorComponent) Role() string
Role implements Component interface.
type MonitorInstance ¶
type MonitorInstance struct { BaseInstance // contains filtered or unexported fields }
MonitorInstance represent the monitor instance
func (*MonitorInstance) InitConfig ¶
func (i *MonitorInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error
InitConfig implement 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) Role ¶ added in v1.1.0
func (c *PDComponent) Role() string
Role implements Component interface.
type PDInstance ¶
type PDInstance struct { Name string BaseInstance // contains filtered or unexported fields }
PDInstance represent the PD instance
func (*PDInstance) InitConfig ¶
func (i *PDInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error
InitConfig implement Instance interface
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) ScaleConfig ¶
func (i *PDInstance) ScaleConfig(e executor.Executor, topo Topology, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error
ScaleConfig deploy temporary config on scaling
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 ¶
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" 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"` RuleDir string `yaml:"rule_dir,omitempty" validate:"rule_dir:editable"` }
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.
func (*PumpComponent) Role ¶ added in v1.1.0
func (c *PumpComponent) Role() string
Role implements Component interface.
type PumpInstance ¶
type PumpInstance struct { BaseInstance // contains filtered or unexported fields }
PumpInstance represent the Pump instance.
func (*PumpInstance) InitConfig ¶
func (i *PumpInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error
InitConfig 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
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 ¶
GetMainPort returns the main port of the instance
func (PumpSpec) IsImported ¶
IsImported returns if the node is imported from TiDB-Ansible
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) GetAllClusters ¶ added in v1.1.0
func (s *SpecManager) GetAllClusters() (map[string]Metadata, error)
GetAllClusters get a metadata list of all clusters deployed by current user
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.
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) 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.
func (*TiDBComponent) Role ¶ added in v1.1.0
func (c *TiDBComponent) Role() string
Role implements Component interface.
type TiDBInstance ¶
type TiDBInstance struct { BaseInstance // contains filtered or unexported fields }
TiDBInstance represent the TiDB instance
func (*TiDBInstance) InitConfig ¶
func (i *TiDBInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error
InitConfig implement 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
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 ¶
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{ *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.
func (*TiFlashComponent) Role ¶ added in v1.1.0
func (c *TiFlashComponent) Role() string
Role implements Component interface.
type TiFlashInstance ¶
type TiFlashInstance struct { BaseInstance // contains filtered or unexported fields }
TiFlashInstance represent the TiFlash instance
func (*TiFlashInstance) DataDir ¶
func (i *TiFlashInstance) DataDir() string
DataDir represents TiFlash's DataDir
func (*TiFlashInstance) GetServicePort ¶
func (i *TiFlashInstance) GetServicePort() int
GetServicePort returns the service port of TiFlash
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, clusterVersion string, src map[string]interface{}) (map[string]interface{}, error)
InitTiFlashLearnerConfig initializes TiFlash learner config file
func (*TiFlashInstance) PrepareStart ¶
func (i *TiFlashInstance) PrepareStart() error
PrepareStart checks TiFlash requirements before starting
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
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.
func (*TiKVComponent) Role ¶ added in v1.1.0
func (c *TiKVComponent) Role() string
Role implements Component interface.
type TiKVInstance ¶
type TiKVInstance struct { BaseInstance // contains filtered or unexported fields }
TiKVInstance represent the TiDB instance
func (*TiKVInstance) InitConfig ¶
func (i *TiKVInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error
InitConfig implement Instance interface
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) ScaleConfig ¶
func (i *TiKVInstance) ScaleConfig(e executor.Executor, topo Topology, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error
ScaleConfig deploy temporary config on scaling
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 ¶
GetMainPort returns the main port of the instance
func (TiKVSpec) IsImported ¶
IsImported returns if the node is imported from TiDB-Ansible
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.
func (*TiSparkMasterComponent) Role ¶ added in v1.1.0
func (c *TiSparkMasterComponent) Role() string
Role implements Component interface.
type TiSparkMasterInstance ¶ added in v1.0.9
type TiSparkMasterInstance struct { BaseInstance // contains filtered or unexported fields }
TiSparkMasterInstance represent the TiSpark master instance
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) GetJavaHome ¶ added in v1.0.9
func (i *TiSparkMasterInstance) GetJavaHome() string
GetJavaHome returns the java_home value in spec
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) 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
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:ignore"` SparkEnvs map[string]string `yaml:"spark_env,omitempty" validate:"spark_env:ignore"` 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.
func (*TiSparkWorkerComponent) Role ¶ added in v1.1.0
func (c *TiSparkWorkerComponent) Role() string
Role implements Component interface.
type TiSparkWorkerInstance ¶ added in v1.0.9
type TiSparkWorkerInstance struct { BaseInstance // contains filtered or unexported fields }
TiSparkWorkerInstance represent the TiSpark slave instance
func (*TiSparkWorkerInstance) GetJavaHome ¶ added in v1.0.9
func (i *TiSparkWorkerInstance) GetJavaHome() string
GetJavaHome returns the java_home value in spec
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) 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
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
UpgradableMetadata represents a upgradable Metadata.