Documentation ¶
Index ¶
- Constants
- func AllDMComponentNames() (roles []string)
- func GetSpecManager() *cspec.SpecManager
- type AlertmanagerSpec
- type Component
- type ComponentSources
- type DMMasterComponent
- func (c *DMMasterComponent) CalculateVersion(clusterVersion string) string
- func (c *DMMasterComponent) Instances() []Instance
- func (c *DMMasterComponent) Name() string
- func (c *DMMasterComponent) Role() string
- func (c *DMMasterComponent) SetVersion(version string)
- func (c *DMMasterComponent) Source() string
- type DMServerConfigs
- type DMWorkerComponent
- func (c *DMWorkerComponent) CalculateVersion(clusterVersion string) string
- func (c *DMWorkerComponent) Instances() []Instance
- func (c *DMWorkerComponent) Name() string
- func (c *DMWorkerComponent) Role() string
- func (c *DMWorkerComponent) SetVersion(version string)
- func (c *DMWorkerComponent) Source() string
- type GlobalOptions
- type GrafanaSpec
- type Instance
- type InstanceSpec
- type MasterInstance
- type MasterSpec
- func (s *MasterSpec) GetAdvertisePeerURL(enableTLS bool) string
- func (s *MasterSpec) GetMainPort() int
- func (s *MasterSpec) IgnoreMonitorAgent() bool
- func (s *MasterSpec) IsImported() bool
- func (s *MasterSpec) Role() string
- func (s *MasterSpec) SSH() (string, int)
- func (s *MasterSpec) Status(_ context.Context, timeout time.Duration, tlsCfg *tls.Config, _ ...string) string
- type Metadata
- type MonitoredOptions
- type PrometheusSpec
- type ResourceControl
- type Specification
- func (s *Specification) BaseTopo() *spec.BaseTopo
- func (topo *Specification) ComponentsByStartOrder() (comps []Component)
- func (topo *Specification) ComponentsByStopOrder() (comps []Component)
- func (topo *Specification) ComponentsByUpdateOrder(curVer string) (comps []Component)
- func (s *Specification) CountDir(targetHost, dirPrefix string) int
- func (s *Specification) FillHostArchOrOS(hostArch map[string]string, fullType spec.FullHostType) error
- func (topo *Specification) GetGlobalOptions() spec.GlobalOptions
- func (s *Specification) GetGrafanaConfig() map[string]string
- func (s *Specification) GetMasterListWithManageHost() []string
- func (topo *Specification) GetMonitoredOptions() *spec.MonitoredOptions
- func (topo *Specification) IterComponent(fn func(comp Component))
- func (topo *Specification) IterHost(fn func(instance Instance))
- func (topo *Specification) IterInstance(fn func(instance Instance), concurrency ...int)
- func (s *Specification) Merge(that spec.Topology) spec.Topology
- func (s *Specification) MergeTopo(rhs spec.Topology) spec.Topology
- func (s *Specification) NewPart() spec.Topology
- func (s *Specification) TLSConfig(dir string) (*tls.Config, error)
- func (s *Specification) Type() string
- func (s *Specification) UnmarshalYAML(unmarshal func(any) error) error
- func (s *Specification) Validate() error
- type WorkerInstance
- type WorkerSpec
- func (s *WorkerSpec) GetMainPort() int
- func (s *WorkerSpec) IgnoreMonitorAgent() bool
- func (s *WorkerSpec) IsImported() bool
- func (s *WorkerSpec) Role() string
- func (s *WorkerSpec) SSH() (string, int)
- func (s *WorkerSpec) Status(_ context.Context, timeout time.Duration, tlsCfg *tls.Config, ...) string
Constants ¶
const ( ComponentDMMaster = spec.ComponentDMMaster ComponentDMWorker = spec.ComponentDMWorker ComponentPrometheus = spec.ComponentPrometheus ComponentGrafana = spec.ComponentGrafana ComponentAlertmanager = spec.ComponentAlertmanager )
Components names supported by TiUP
Variables ¶
This section is empty.
Functions ¶
func AllDMComponentNames ¶
func AllDMComponentNames() (roles []string)
AllDMComponentNames contains the names of all dm components. should include all components in ComponentsByStartOrder
func GetSpecManager ¶
func GetSpecManager() *cspec.SpecManager
GetSpecManager return the spec manager of dm cluster.
Types ¶
type AlertmanagerSpec ¶ added in v1.3.0
type AlertmanagerSpec = spec.AlertmanagerSpec
AlertmanagerSpec is the spec of Alertmanager
type ComponentSources ¶ added in v1.14.0
type ComponentSources struct { Master string `yaml:"master,omitempty"` Worker string `yaml:"worker,omitempty"` }
ComponentSources represents the source of components
type DMMasterComponent ¶
type DMMasterComponent struct{ Topology *Specification }
DMMasterComponent represents TiDB component.
func (*DMMasterComponent) CalculateVersion ¶ added in v1.14.0
func (c *DMMasterComponent) CalculateVersion(clusterVersion string) string
CalculateVersion implements the Component interface
func (*DMMasterComponent) Instances ¶
func (c *DMMasterComponent) Instances() []Instance
Instances implements Component interface.
func (*DMMasterComponent) Name ¶
func (c *DMMasterComponent) Name() string
Name implements Component interface.
func (*DMMasterComponent) Role ¶ added in v1.1.0
func (c *DMMasterComponent) Role() string
Role implements Component interface.
func (*DMMasterComponent) SetVersion ¶ added in v1.14.0
func (c *DMMasterComponent) SetVersion(version string)
SetVersion implements Component interface.
func (*DMMasterComponent) Source ¶ added in v1.14.0
func (c *DMMasterComponent) Source() string
Source implements Component interface.
type DMServerConfigs ¶
type DMServerConfigs struct { Master map[string]any `yaml:"master"` Worker map[string]any `yaml:"worker"` Grafana map[string]string `yaml:"grafana"` }
DMServerConfigs represents the server runtime configuration
type DMWorkerComponent ¶
type DMWorkerComponent struct{ Topology *Specification }
DMWorkerComponent represents DM worker component.
func (*DMWorkerComponent) CalculateVersion ¶ added in v1.14.0
func (c *DMWorkerComponent) CalculateVersion(clusterVersion string) string
CalculateVersion implements the Component interface
func (*DMWorkerComponent) Instances ¶
func (c *DMWorkerComponent) Instances() []Instance
Instances implements Component interface.
func (*DMWorkerComponent) Name ¶
func (c *DMWorkerComponent) Name() string
Name implements Component interface.
func (*DMWorkerComponent) Role ¶ added in v1.1.0
func (c *DMWorkerComponent) Role() string
Role implements Component interface.
func (*DMWorkerComponent) SetVersion ¶ added in v1.14.0
func (c *DMWorkerComponent) SetVersion(version string)
SetVersion implements Component interface.
func (*DMWorkerComponent) Source ¶ added in v1.14.0
func (c *DMWorkerComponent) Source() string
Source implements Component interface.
type InstanceSpec ¶
type InstanceSpec interface { Role() string SSH() (string, int) GetMainPort() int IsImported() bool IgnoreMonitorAgent() bool }
InstanceSpec represent a instance specification
type MasterInstance ¶ added in v1.1.0
type MasterInstance struct { Name string spec.BaseInstance // contains filtered or unexported fields }
MasterInstance represent the TiDB instance
type MasterSpec ¶
type MasterSpec struct { Host string `yaml:"host"` ManageHost string `yaml:"manage_host,omitempty" validate:"manage_host:editable"` SSHPort int `yaml:"ssh_port,omitempty" validate:"ssh_port:editable"` Imported bool `yaml:"imported,omitempty"` Patched bool `yaml:"patched,omitempty"` IgnoreExporter bool `yaml:"ignore_exporter,omitempty"` // Use Name to get the name with a default value if it's empty. Name string `yaml:"name,omitempty"` Port int `yaml:"port,omitempty" default:"8261"` PeerPort int `yaml:"peer_port,omitempty" default:"8291"` DeployDir string `yaml:"deploy_dir,omitempty"` DataDir string `yaml:"data_dir,omitempty"` LogDir string `yaml:"log_dir,omitempty"` Source string `yaml:"source,omitempty" validate:"source:editable"` NumaNode string `yaml:"numa_node,omitempty" validate:"numa_node:editable"` Config map[string]any `yaml:"config,omitempty" validate:"config:ignore"` ResourceControl ResourceControl `yaml:"resource_control,omitempty" validate:"resource_control:editable"` Arch string `yaml:"arch,omitempty"` OS string `yaml:"os,omitempty"` V1SourcePath string `yaml:"v1_source_path,omitempty"` }
MasterSpec represents the Master topology specification in topology.yaml
func (*MasterSpec) GetAdvertisePeerURL ¶ added in v1.12.0
func (s *MasterSpec) GetAdvertisePeerURL(enableTLS bool) string
GetAdvertisePeerURL returns AdvertisePeerURL
func (*MasterSpec) GetMainPort ¶
func (s *MasterSpec) GetMainPort() int
GetMainPort returns the main port of the instance
func (*MasterSpec) IgnoreMonitorAgent ¶ added in v1.6.0
func (s *MasterSpec) IgnoreMonitorAgent() bool
IgnoreMonitorAgent returns if the node does not have monitor agents available
func (*MasterSpec) IsImported ¶
func (s *MasterSpec) IsImported() bool
IsImported returns if the node is imported from TiDB-Ansible
func (*MasterSpec) Role ¶
func (s *MasterSpec) Role() string
Role returns the component role of the instance
func (*MasterSpec) SSH ¶
func (s *MasterSpec) SSH() (string, int)
SSH returns the host and SSH port of the instance
type Metadata ¶
type Metadata struct { User string `yaml:"user"` // the user to run and manage cluster on remote Version string `yaml:"dm_version"` // the version of TiDB cluster Topology *Specification `yaml:"topology"` }
Metadata is the specification of generic cluster metadata
func (*Metadata) GetBaseMeta ¶
GetBaseMeta implements Metadata interface.
func (*Metadata) GetTopology ¶
GetTopology implements Metadata interface.
func (*Metadata) SetTopology ¶
SetTopology implements Metadata interface.
func (*Metadata) SetVersion ¶
SetVersion implement UpgradableMetadata interface.
type MonitoredOptions ¶ added in v1.4.0
type MonitoredOptions = spec.MonitoredOptions
MonitoredOptions is the spec of Monitored
type PrometheusSpec ¶
type PrometheusSpec = spec.PrometheusSpec
PrometheusSpec is the spec of Prometheus
type ResourceControl ¶
type ResourceControl = meta.ResourceControl
ResourceControl is the spec of ResourceControl
type Specification ¶ added in v1.3.0
type Specification struct { GlobalOptions GlobalOptions `yaml:"global,omitempty" validate:"global:editable"` MonitoredOptions *MonitoredOptions `yaml:"monitored,omitempty" validate:"monitored:editable"` ComponentSources ComponentSources `yaml:"component_sources,omitempty" validate:"component_sources:editable"` ServerConfigs DMServerConfigs `yaml:"server_configs,omitempty" validate:"server_configs:ignore"` Masters []*MasterSpec `yaml:"master_servers"` Workers []*WorkerSpec `yaml:"worker_servers"` Monitors []*spec.PrometheusSpec `yaml:"monitoring_servers"` Grafanas []*spec.GrafanaSpec `yaml:"grafana_servers,omitempty"` Alertmanagers []*spec.AlertmanagerSpec `yaml:"alertmanager_servers,omitempty"` }
Specification represents the specification of topology.yaml
func (*Specification) BaseTopo ¶ added in v1.3.0
func (s *Specification) BaseTopo() *spec.BaseTopo
BaseTopo implements Topology interface.
func (*Specification) ComponentsByStartOrder ¶ added in v1.3.0
func (topo *Specification) ComponentsByStartOrder() (comps []Component)
ComponentsByStartOrder return component in the order need to start.
func (*Specification) ComponentsByStopOrder ¶ added in v1.3.0
func (topo *Specification) ComponentsByStopOrder() (comps []Component)
ComponentsByStopOrder return component in the order need to stop.
func (*Specification) ComponentsByUpdateOrder ¶ added in v1.3.0
func (topo *Specification) ComponentsByUpdateOrder(curVer string) (comps []Component)
ComponentsByUpdateOrder return component in the order need to be updated.
func (*Specification) CountDir ¶ added in v1.3.0
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) FillHostArchOrOS ¶ added in v1.10.0
func (s *Specification) FillHostArchOrOS(hostArch map[string]string, fullType spec.FullHostType) error
FillHostArchOrOS fills the topology with the given host->arch
func (*Specification) GetGlobalOptions ¶ added in v1.3.0
func (topo *Specification) GetGlobalOptions() spec.GlobalOptions
GetGlobalOptions returns cluster topology
func (*Specification) GetGrafanaConfig ¶ added in v1.9.0
func (s *Specification) GetGrafanaConfig() map[string]string
GetGrafanaConfig returns global grafana configurations
func (*Specification) GetMasterListWithManageHost ¶ added in v1.12.3
func (s *Specification) GetMasterListWithManageHost() []string
GetMasterListWithManageHost returns a list of Master API hosts of the current cluster
func (*Specification) GetMonitoredOptions ¶ added in v1.3.0
func (topo *Specification) GetMonitoredOptions() *spec.MonitoredOptions
GetMonitoredOptions returns MonitoredOptions
func (*Specification) IterComponent ¶ added in v1.3.0
func (topo *Specification) IterComponent(fn func(comp Component))
IterComponent iterates all components in component starting order
func (*Specification) IterHost ¶ added in v1.3.0
func (topo *Specification) IterHost(fn func(instance Instance))
IterHost iterates one instance for each host
func (*Specification) IterInstance ¶ added in v1.3.0
func (topo *Specification) IterInstance(fn func(instance Instance), concurrency ...int)
IterInstance iterates all instances in component starting order
func (*Specification) Merge ¶ added in v1.3.0
func (s *Specification) Merge(that spec.Topology) spec.Topology
Merge returns a new Topology which sum old ones
func (*Specification) MergeTopo ¶ added in v1.3.0
func (s *Specification) MergeTopo(rhs spec.Topology) spec.Topology
MergeTopo implements ScaleOutTopology interface.
func (*Specification) NewPart ¶ added in v1.3.0
func (s *Specification) NewPart() spec.Topology
NewPart implements ScaleOutTopology interface.
func (*Specification) TLSConfig ¶ added in v1.3.0
func (s *Specification) TLSConfig(dir string) (*tls.Config, error)
TLSConfig generates a tls.Config for the specification as needed
func (*Specification) Type ¶ added in v1.3.0
func (s *Specification) Type() string
Type implements Topology interface.
func (*Specification) UnmarshalYAML ¶ added in v1.3.0
func (s *Specification) UnmarshalYAML(unmarshal func(any) error) error
UnmarshalYAML sets default values when unmarshaling the topology file
func (*Specification) Validate ¶ added in v1.3.0
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 WorkerInstance ¶ added in v1.1.0
type WorkerInstance struct { Name string spec.BaseInstance // contains filtered or unexported fields }
WorkerInstance represent the DM worker instance
type WorkerSpec ¶
type WorkerSpec struct { Host string `yaml:"host"` ManageHost string `yaml:"manage_host,omitempty" validate:"manage_host:editable"` SSHPort int `yaml:"ssh_port,omitempty" validate:"ssh_port:editable"` Imported bool `yaml:"imported,omitempty"` Patched bool `yaml:"patched,omitempty"` IgnoreExporter bool `yaml:"ignore_exporter,omitempty"` // Use Name to get the name with a default value if it's empty. Name string `yaml:"name,omitempty"` Port int `yaml:"port,omitempty" default:"8262"` DeployDir string `yaml:"deploy_dir,omitempty"` DataDir string `yaml:"data_dir,omitempty"` LogDir string `yaml:"log_dir,omitempty"` Source string `yaml:"source,omitempty" validate:"source:editable"` NumaNode string `yaml:"numa_node,omitempty" validate:"numa_node:editable"` Config map[string]any `yaml:"config,omitempty" validate:"config:ignore"` ResourceControl ResourceControl `yaml:"resource_control,omitempty" validate:"resource_control:editable"` Arch string `yaml:"arch,omitempty"` OS string `yaml:"os,omitempty"` }
WorkerSpec represents the Master topology specification in topology.yaml
func (*WorkerSpec) GetMainPort ¶
func (s *WorkerSpec) GetMainPort() int
GetMainPort returns the main port of the instance
func (*WorkerSpec) IgnoreMonitorAgent ¶ added in v1.6.0
func (s *WorkerSpec) IgnoreMonitorAgent() bool
IgnoreMonitorAgent returns if the node does not have monitor agents available
func (*WorkerSpec) IsImported ¶
func (s *WorkerSpec) IsImported() bool
IsImported returns if the node is imported from TiDB-Ansible
func (*WorkerSpec) Role ¶
func (s *WorkerSpec) Role() string
Role returns the component role of the instance
func (*WorkerSpec) SSH ¶
func (s *WorkerSpec) SSH() (string, int)
SSH returns the host and SSH port of the instance