Documentation ¶
Index ¶
- Constants
- func AllDMComponentNames() (roles []string)
- func GetSpecManager() *meta.SpecManager
- func PortStarted(e executor.Executor, port int, timeout int64) error
- func PortStopped(e executor.Executor, port int, timeout int64) error
- type AlertManagerSpec
- type Component
- type DMMasterComponent
- type DMMasterInstance
- func (i *DMMasterInstance) Arch() string
- func (i *DMMasterInstance) ComponentName() string
- func (i *DMMasterInstance) DataDir() string
- func (i *DMMasterInstance) DeployDir() string
- func (i *DMMasterInstance) GetHost() string
- func (i *DMMasterInstance) GetPort() int
- func (i *DMMasterInstance) GetSSHPort() int
- func (i *DMMasterInstance) ID() string
- func (i *DMMasterInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, ...) error
- func (i *DMMasterInstance) InstanceName() string
- func (i *DMMasterInstance) LogDir() string
- func (i *DMMasterInstance) OS() string
- func (i *DMMasterInstance) PrepareStart() error
- func (i *DMMasterInstance) Ready(e executor.Executor, timeout int64) error
- func (i *DMMasterInstance) ScaleConfig(e executor.Executor, b *spec.Specification, ...) error
- func (i *DMMasterInstance) ServiceName() string
- func (i *DMMasterInstance) Status(masterList ...string) string
- func (i *DMMasterInstance) UsedDirs() []string
- func (i *DMMasterInstance) UsedPorts() []int
- func (i *DMMasterInstance) WaitForDown(e executor.Executor, timeout int64) error
- type DMMeta
- type DMPortalComponent
- type DMPortalInstance
- func (i *DMPortalInstance) Arch() string
- func (i *DMPortalInstance) ComponentName() string
- func (i *DMPortalInstance) DataDir() string
- func (i *DMPortalInstance) DeployDir() string
- func (i *DMPortalInstance) GetHost() string
- func (i *DMPortalInstance) GetPort() int
- func (i *DMPortalInstance) GetSSHPort() int
- func (i *DMPortalInstance) ID() string
- func (i *DMPortalInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, ...) error
- func (i *DMPortalInstance) InstanceName() string
- func (i *DMPortalInstance) LogDir() string
- func (i *DMPortalInstance) OS() string
- func (i *DMPortalInstance) PrepareStart() error
- func (i *DMPortalInstance) Ready(e executor.Executor, timeout int64) error
- func (i *DMPortalInstance) ScaleConfig(e executor.Executor, b *spec.Specification, ...) error
- func (i *DMPortalInstance) ServiceName() string
- func (i *DMPortalInstance) Status(masterList ...string) string
- func (i *DMPortalInstance) UsedDirs() []string
- func (i *DMPortalInstance) UsedPorts() []int
- func (i *DMPortalInstance) WaitForDown(e executor.Executor, timeout int64) error
- type DMSSpecification
- func (topo *DMSSpecification) ComponentsByStartOrder() (comps []Component)
- func (topo *DMSSpecification) ComponentsByStopOrder() (comps []Component)
- func (topo *DMSSpecification) ComponentsByUpdateOrder() (comps []Component)
- func (topo *DMSSpecification) Endpoints(user string) []*scripts.DMMasterScript
- func (topo *DMSSpecification) GetGlobalOptions() spec.GlobalOptions
- func (topo *DMSSpecification) GetMonitoredOptions() *spec.MonitoredOptions
- func (topo *DMSSpecification) IterComponent(fn func(comp Component))
- func (topo *DMSSpecification) IterHost(fn func(instance Instance))
- func (topo *DMSSpecification) IterInstance(fn func(instance Instance))
- type DMServerConfigs
- type DMTopologySpecification
- func (topo *DMTopologySpecification) CountDir(targetHost, dirPrefix string) int
- func (topo *DMTopologySpecification) GetMasterList() []string
- func (topo *DMTopologySpecification) Merge(that *DMTopologySpecification) *DMTopologySpecification
- func (topo *DMTopologySpecification) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (topo *DMTopologySpecification) Validate() error
- type DMWorkerComponent
- type DMWorkerInstance
- func (i *DMWorkerInstance) Arch() string
- func (i *DMWorkerInstance) ComponentName() string
- func (i *DMWorkerInstance) DataDir() string
- func (i *DMWorkerInstance) DeployDir() string
- func (i *DMWorkerInstance) GetHost() string
- func (i *DMWorkerInstance) GetPort() int
- func (i *DMWorkerInstance) GetSSHPort() int
- func (i *DMWorkerInstance) ID() string
- func (i *DMWorkerInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, ...) error
- func (i *DMWorkerInstance) InstanceName() string
- func (i *DMWorkerInstance) LogDir() string
- func (i *DMWorkerInstance) OS() string
- func (i *DMWorkerInstance) PrepareStart() error
- func (i *DMWorkerInstance) Ready(e executor.Executor, timeout int64) error
- func (i *DMWorkerInstance) ScaleConfig(e executor.Executor, b *spec.Specification, ...) error
- func (i *DMWorkerInstance) ServiceName() string
- func (i *DMWorkerInstance) Status(masterList ...string) string
- func (i *DMWorkerInstance) UsedDirs() []string
- func (i *DMWorkerInstance) UsedPorts() []int
- func (i *DMWorkerInstance) WaitForDown(e executor.Executor, timeout int64) error
- type GlobalOptions
- type GrafanaSpec
- type Instance
- type InstanceSpec
- type MasterSpec
- type PortalSpec
- type PrometheusSpec
- type ResourceControl
- type WorkerSpec
Constants ¶
const ( ComponentDMMaster = "dm-master" ComponentDMWorker = "dm-worker" ComponentDMPortal = "dm-portal" ComponentDumpling = "dumpling" ComponentLightning = "lightning" ComponentImporter = "importer" ComponentPrometheus = spec.ComponentPrometheus ComponentGrafana = spec.ComponentGrafana ComponentAlertManager = spec.ComponentAlertManager )
Components names supported by TiOps
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() *meta.SpecManager
GetSpecManager return the spec manager of dm cluster.
func PortStarted ¶
PortStarted wait until a port is being listened
Types ¶
type AlertManagerSpec ¶
type AlertManagerSpec = spec.AlertManagerSpec
AlertManagerSpec is the spec of Alertmanager
type DMMasterComponent ¶
type DMMasterComponent struct{ *DMSSpecification }
DMMasterComponent represents TiDB component.
func (*DMMasterComponent) Instances ¶
func (c *DMMasterComponent) Instances() []Instance
Instances implements Component interface.
func (*DMMasterComponent) Name ¶
func (c *DMMasterComponent) Name() string
Name implements Component interface.
type DMMasterInstance ¶
type DMMasterInstance struct { Name string // contains filtered or unexported fields }
DMMasterInstance represent the TiDB instance
func (*DMMasterInstance) ComponentName ¶
func (i *DMMasterInstance) ComponentName() string
ComponentName implements Instance interface
func (*DMMasterInstance) GetHost ¶
func (i *DMMasterInstance) GetHost() string
GetHost implements Instance interface
func (*DMMasterInstance) GetSSHPort ¶
func (i *DMMasterInstance) GetSSHPort() int
GetSSHPort implements Instance interface
func (*DMMasterInstance) ID ¶
func (i *DMMasterInstance) ID() string
ID returns the identifier of this instance, the ID is constructed by host:port
func (*DMMasterInstance) InitConfig ¶
func (i *DMMasterInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error
InitConfig implement Instance interface
func (*DMMasterInstance) InstanceName ¶
func (i *DMMasterInstance) InstanceName() string
InstanceName implements Instance interface
func (*DMMasterInstance) PrepareStart ¶
func (i *DMMasterInstance) PrepareStart() error
func (*DMMasterInstance) ScaleConfig ¶
func (i *DMMasterInstance) ScaleConfig(e executor.Executor, b *spec.Specification, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error
ScaleConfig deploy temporary config on scaling
func (*DMMasterInstance) ServiceName ¶
func (i *DMMasterInstance) ServiceName() string
ServiceName implements Instance interface
type DMMeta ¶
type DMMeta 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 *DMTopologySpecification `yaml:"topology"` }
DMMeta is the specification of generic cluster metadata
type DMPortalComponent ¶
type DMPortalComponent struct {
*DMSSpecification
}
DMPortalComponent represents DM portal component.
func (*DMPortalComponent) Instances ¶
func (c *DMPortalComponent) Instances() []Instance
Instances implements Component interface.
func (*DMPortalComponent) Name ¶
func (c *DMPortalComponent) Name() string
Name implements Component interface.
type DMPortalInstance ¶
type DMPortalInstance struct {
// contains filtered or unexported fields
}
DMPortalInstance represent the DM portal instance
func (*DMPortalInstance) ComponentName ¶
func (i *DMPortalInstance) ComponentName() string
ComponentName implements Instance interface
func (*DMPortalInstance) GetHost ¶
func (i *DMPortalInstance) GetHost() string
GetHost implements Instance interface
func (*DMPortalInstance) GetSSHPort ¶
func (i *DMPortalInstance) GetSSHPort() int
GetSSHPort implements Instance interface
func (*DMPortalInstance) ID ¶
func (i *DMPortalInstance) ID() string
ID returns the identifier of this instance, the ID is constructed by host:port
func (*DMPortalInstance) InitConfig ¶
func (i *DMPortalInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error
InitConfig implement Instance interface
func (*DMPortalInstance) InstanceName ¶
func (i *DMPortalInstance) InstanceName() string
InstanceName implements Instance interface
func (*DMPortalInstance) PrepareStart ¶
func (i *DMPortalInstance) PrepareStart() error
func (*DMPortalInstance) ScaleConfig ¶
func (i *DMPortalInstance) ScaleConfig(e executor.Executor, b *spec.Specification, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error
ScaleConfig deploy temporary config on scaling
func (*DMPortalInstance) ServiceName ¶
func (i *DMPortalInstance) ServiceName() string
ServiceName implements Instance interface
type DMSSpecification ¶
type DMSSpecification = DMTopologySpecification
DMSSpecification of cluster
func (*DMSSpecification) ComponentsByStartOrder ¶
func (topo *DMSSpecification) ComponentsByStartOrder() (comps []Component)
ComponentsByStartOrder return component in the order need to start.
func (*DMSSpecification) ComponentsByStopOrder ¶
func (topo *DMSSpecification) ComponentsByStopOrder() (comps []Component)
ComponentsByStopOrder return component in the order need to stop.
func (*DMSSpecification) ComponentsByUpdateOrder ¶
func (topo *DMSSpecification) ComponentsByUpdateOrder() (comps []Component)
ComponentsByUpdateOrder return component in the order need to be updated.
func (*DMSSpecification) Endpoints ¶
func (topo *DMSSpecification) Endpoints(user string) []*scripts.DMMasterScript
Endpoints returns the PD endpoints configurations
func (*DMSSpecification) GetGlobalOptions ¶
func (topo *DMSSpecification) GetGlobalOptions() spec.GlobalOptions
GetGlobalOptions returns cluster topology
func (*DMSSpecification) GetMonitoredOptions ¶
func (topo *DMSSpecification) GetMonitoredOptions() *spec.MonitoredOptions
GetMonitoredOptions returns MonitoredOptions
func (*DMSSpecification) IterComponent ¶
func (topo *DMSSpecification) IterComponent(fn func(comp Component))
IterComponent iterates all components in component starting order
func (*DMSSpecification) IterHost ¶
func (topo *DMSSpecification) IterHost(fn func(instance Instance))
IterHost iterates one instance for each host
func (*DMSSpecification) IterInstance ¶
func (topo *DMSSpecification) IterInstance(fn func(instance Instance))
IterInstance iterates all instances in component starting order
type DMServerConfigs ¶
type DMServerConfigs struct { Master map[string]interface{} `yaml:"dm_master"` Worker map[string]interface{} `yaml:"dm_worker"` Portal map[string]interface{} `yaml:"dm_portal"` }
DMServerConfigs represents the server runtime configuration
type DMTopologySpecification ¶
type DMTopologySpecification struct { GlobalOptions GlobalOptions `yaml:"global,omitempty"` // MonitoredOptions MonitoredOptions `yaml:"monitored,omitempty"` ServerConfigs DMServerConfigs `yaml:"server_configs,omitempty"` Masters []MasterSpec `yaml:"dm_master_servers"` Workers []WorkerSpec `yaml:"dm_worker_servers"` Portals []PortalSpec `yaml:"dm_portal_servers"` Monitors []PrometheusSpec `yaml:"monitoring_servers"` Grafana []GrafanaSpec `yaml:"grafana_servers,omitempty"` Alertmanager []AlertManagerSpec `yaml:"alertmanager_servers,omitempty"` }
DMTopologySpecification represents the specification of topology.yaml
func (*DMTopologySpecification) CountDir ¶
func (topo *DMTopologySpecification) 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 (*DMTopologySpecification) GetMasterList ¶
func (topo *DMTopologySpecification) GetMasterList() []string
GetMasterList returns a list of Master API hosts of the current cluster
func (*DMTopologySpecification) Merge ¶
func (topo *DMTopologySpecification) Merge(that *DMTopologySpecification) *DMTopologySpecification
Merge returns a new DMTopologySpecification which sum old ones
func (*DMTopologySpecification) UnmarshalYAML ¶
func (topo *DMTopologySpecification) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML sets default values when unmarshaling the topology file
func (*DMTopologySpecification) Validate ¶
func (topo *DMTopologySpecification) Validate() error
Validate validates the topology specification and produce error if the specification invalid (e.g: port conflicts or directory conflicts)
type DMWorkerComponent ¶
type DMWorkerComponent struct {
*DMSSpecification
}
DMWorkerComponent represents DM worker component.
func (*DMWorkerComponent) Instances ¶
func (c *DMWorkerComponent) Instances() []Instance
Instances implements Component interface.
func (*DMWorkerComponent) Name ¶
func (c *DMWorkerComponent) Name() string
Name implements Component interface.
type DMWorkerInstance ¶
type DMWorkerInstance struct { Name string // contains filtered or unexported fields }
DMWorkerInstance represent the DM worker instance
func (*DMWorkerInstance) ComponentName ¶
func (i *DMWorkerInstance) ComponentName() string
ComponentName implements Instance interface
func (*DMWorkerInstance) GetHost ¶
func (i *DMWorkerInstance) GetHost() string
GetHost implements Instance interface
func (*DMWorkerInstance) GetSSHPort ¶
func (i *DMWorkerInstance) GetSSHPort() int
GetSSHPort implements Instance interface
func (*DMWorkerInstance) ID ¶
func (i *DMWorkerInstance) ID() string
ID returns the identifier of this instance, the ID is constructed by host:port
func (*DMWorkerInstance) InitConfig ¶
func (i *DMWorkerInstance) InitConfig(e executor.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error
InitConfig implement Instance interface
func (*DMWorkerInstance) InstanceName ¶
func (i *DMWorkerInstance) InstanceName() string
InstanceName implements Instance interface
func (*DMWorkerInstance) PrepareStart ¶
func (i *DMWorkerInstance) PrepareStart() error
func (*DMWorkerInstance) ScaleConfig ¶
func (i *DMWorkerInstance) ScaleConfig(e executor.Executor, b *spec.Specification, clusterName, clusterVersion, deployUser string, paths meta.DirPaths) error
ScaleConfig deploy temporary config on scaling
func (*DMWorkerInstance) ServiceName ¶
func (i *DMWorkerInstance) ServiceName() string
ServiceName implements Instance interface
type InstanceSpec ¶
type InstanceSpec interface { Role() string SSH() (string, int) GetMainPort() int IsImported() bool }
InstanceSpec represent a instance specification
type MasterSpec ¶
type MasterSpec struct { Host string `yaml:"host"` 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"` Port int `yaml:"port" default:"8261"` PeerPort int `yaml:"peer_port" default:"8291"` 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"` }
MasterSpec represents the Master topology specification in topology.yaml
func (MasterSpec) GetMainPort ¶
func (s MasterSpec) GetMainPort() int
GetMainPort returns the main port of the instance
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
func (MasterSpec) Status ¶
func (s MasterSpec) Status(masterList ...string) string
Status queries current status of the instance
type PortalSpec ¶
type PortalSpec struct { Host string `yaml:"host"` SSHPort int `yaml:"ssh_port,omitempty"` Imported bool `yaml:"imported,omitempty"` Port int `yaml:"port" default:"8280"` DeployDir string `yaml:"deploy_dir,omitempty"` DataDir string `yaml:"data_dir,omitempty"` LogDir string `yaml:"log_dir,omitempty"` Timeout int `yaml:"timeout" default:"5"` 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"` }
PortalSpec represents the Portal topology specification in topology.yaml
func (PortalSpec) GetMainPort ¶
func (s PortalSpec) GetMainPort() int
GetMainPort returns the main port of the instance
func (PortalSpec) IsImported ¶
func (s PortalSpec) IsImported() bool
IsImported returns if the node is imported from TiDB-Ansible
func (PortalSpec) Role ¶
func (s PortalSpec) Role() string
Role returns the component role of the instance
func (PortalSpec) SSH ¶
func (s PortalSpec) SSH() (string, int)
SSH returns the host and SSH port of the instance
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 WorkerSpec ¶
type WorkerSpec struct { Host string `yaml:"host"` 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"` Port int `yaml:"port" default:"8262"` 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"` }
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) 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
func (WorkerSpec) Status ¶
func (s WorkerSpec) Status(masterList ...string) string
Status queries current status of the instance