Documentation
¶
Index ¶
- Constants
- Variables
- func Abs(user, path string) string
- func AllComponentNames() (roles []string)
- func AuditDir() string
- func CheckClusterDirConflict(clusterList map[string]Metadata, clusterName string, topo Topology) error
- func CheckClusterDirOverlap(entries []DirEntry) error
- func CheckClusterPortConflict(clusterList map[string]Metadata, clusterName string, topo Topology) error
- func CheckTiKVLabels(pdLocLabels []string, slp TiKVLabelProvider) error
- func ClusterPath(cluster string, subpath ...string) string
- func ComponentSubDir(comp, version string) string
- func ExpandRelativeDir(topo Topology)
- func FillHostArchOrOS(s any, hostArchOrOS map[string]string, fullType FullHostType) error
- func FlattenMap(ms map[string]any) map[string]any
- func FoldMap(ms map[string]any) map[string]any
- func GetDMMasterPackageName(topo Topology) string
- func GetValueFromPath(m map[string]any, p string) any
- func HandleImportPathMigration(clsName string) error
- func Initialize(base string) error
- func IterHost(topo Topology, fn func(instance Instance))
- func LoadClientCert(dir string) (*tls.Config, error)
- func Merge2Toml(comp string, global, overwrite map[string]any) ([]byte, error)
- func MergeConfig(orig map[string]any, overwrites ...map[string]any) map[string]any
- func MergeResourceControl(lhs, rhs meta.ResourceControl) meta.ResourceControl
- func MultiDirAbs(user, paths string) []string
- func PackagePath(comp string, version string, os string, arch string) string
- func ParseTopologyYaml(file string, out Topology, ignoreGlobal ...bool) error
- func PortStarted(ctx context.Context, e ctxt.Executor, port int, timeout uint64) error
- func PortStopped(ctx context.Context, e ctxt.Executor, port int, timeout uint64) error
- func ProfileDir() string
- func ProfilePath(subpath ...string) string
- func ReadYamlFile(file string) ([]byte, error)
- func RelativePathDetect(topo any, isSkipField func(reflect.Value) bool) error
- func SaveClusterMeta(clusterName string, cmeta *ClusterMeta) error
- func UptimeByHost(host string, port int, timeout time.Duration, tlsCfg *tls.Config) time.Duration
- type AlertManagerComponent
- func (c *AlertManagerComponent) CalculateVersion(_ string) string
- func (c *AlertManagerComponent) Instances() []Instance
- func (c *AlertManagerComponent) Name() string
- func (c *AlertManagerComponent) Role() string
- func (c *AlertManagerComponent) SetVersion(version string)
- func (c *AlertManagerComponent) Source() string
- type AlertManagerInstance
- type AlertmanagerSpec
- type BaseInstance
- func (i *BaseInstance) Arch() string
- func (i *BaseInstance) CalculateVersion(globalVersion string) string
- func (i *BaseInstance) ComponentName() string
- func (i *BaseInstance) ComponentSource() string
- func (i *BaseInstance) DataDir() string
- func (i *BaseInstance) DeployDir() string
- func (i *BaseInstance) GetHost() string
- func (i *BaseInstance) GetListenHost() string
- func (i *BaseInstance) GetManageHost() string
- func (i *BaseInstance) GetNumaCores() string
- func (i *BaseInstance) GetNumaNode() string
- func (i *BaseInstance) GetPort() int
- func (i *BaseInstance) GetSSHPort() int
- func (i *BaseInstance) ID() string
- func (i *BaseInstance) InitConfig(ctx context.Context, e ctxt.Executor, opt GlobalOptions, user string, ...) (err error)
- func (i *BaseInstance) InstanceName() string
- func (i *BaseInstance) IsPatched() bool
- func (i *BaseInstance) IteratorLocalConfigDir(ctx context.Context, local string, filter func(string) bool, ...) error
- func (i *BaseInstance) LogDir() string
- func (i *BaseInstance) MergeServerConfig(ctx context.Context, e ctxt.Executor, globalConf, instanceConf map[string]any, ...) error
- func (i *BaseInstance) OS() string
- func (i *BaseInstance) PrepareStart(ctx context.Context, tlsCfg *tls.Config) error
- func (i *BaseInstance) Ready(ctx context.Context, e ctxt.Executor, timeout uint64, _ *tls.Config) error
- func (i *BaseInstance) ResourceControl() meta.ResourceControl
- func (i *BaseInstance) ServiceName() string
- func (i *BaseInstance) SetPatched(p bool)
- func (i *BaseInstance) Status(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config, ...) string
- func (i *BaseInstance) TLSDir() string
- func (i *BaseInstance) TransferLocalConfigDir(ctx context.Context, e ctxt.Executor, local, remote string, ...) error
- func (i *BaseInstance) TransferLocalConfigFile(ctx context.Context, e ctxt.Executor, local, remote string) error
- func (i *BaseInstance) Uptime(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config) time.Duration
- func (i *BaseInstance) UsedDirs() []string
- func (i *BaseInstance) UsedPorts() []int
- type BaseMeta
- type BaseTopo
- type CDCComponent
- type CDCInstance
- func (i *CDCInstance) GetAddr() string
- func (i *CDCInstance) InitConfig(ctx context.Context, e ctxt.Executor, ...) error
- func (i *CDCInstance) PostRestart(ctx context.Context, topo Topology, tlsCfg *tls.Config) error
- func (i *CDCInstance) PreRestart(ctx context.Context, topo Topology, apiTimeoutSeconds int, tlsCfg *tls.Config) error
- func (i *CDCInstance) ScaleConfig(ctx context.Context, e ctxt.Executor, topo Topology, ...) error
- type CDCSpec
- type ClusterMeta
- type Component
- type ComponentSources
- type ComponentVersions
- type DashboardComponent
- func (c *DashboardComponent) CalculateVersion(clusterVersion string) string
- func (c *DashboardComponent) Instances() []Instance
- func (c *DashboardComponent) Name() string
- func (c *DashboardComponent) Role() string
- func (c *DashboardComponent) SetVersion(version string)
- func (c *DashboardComponent) Source() string
- type DashboardInstance
- type DashboardSpec
- func (s *DashboardSpec) GetMainPort() int
- func (s *DashboardSpec) GetManageHost() string
- func (s *DashboardSpec) IgnoreMonitorAgent() bool
- func (s *DashboardSpec) IsImported() bool
- func (s *DashboardSpec) Role() string
- func (s *DashboardSpec) SSH() (string, int)
- func (s *DashboardSpec) Status(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config, ...) string
- type DirAccessor
- type DirEntry
- type DrainerComponent
- func (c *DrainerComponent) CalculateVersion(clusterVersion string) string
- func (c *DrainerComponent) Instances() []Instance
- func (c *DrainerComponent) Name() string
- func (c *DrainerComponent) Role() string
- func (c *DrainerComponent) SetVersion(version string)
- func (c *DrainerComponent) Source() string
- type DrainerInstance
- type DrainerSpec
- func (s *DrainerSpec) GetMainPort() int
- func (s *DrainerSpec) GetManageHost() string
- func (s *DrainerSpec) IgnoreMonitorAgent() bool
- func (s *DrainerSpec) IsImported() bool
- func (s *DrainerSpec) Role() string
- func (s *DrainerSpec) SSH() (string, int)
- func (s *DrainerSpec) Status(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config, ...) string
- type ExternalAlertmanager
- type FullHostType
- type GlobalOptions
- type GrafanaComponent
- func (c *GrafanaComponent) CalculateVersion(clusterVersion string) string
- func (c *GrafanaComponent) Instances() []Instance
- func (c *GrafanaComponent) Name() string
- func (c *GrafanaComponent) Role() string
- func (c *GrafanaComponent) SetVersion(version string)
- func (c *GrafanaComponent) Source() string
- type GrafanaInstance
- type GrafanaSpec
- type Instance
- type InstanceSpec
- type Metadata
- type MonitorComponent
- func (c *MonitorComponent) CalculateVersion(clusterVersion string) string
- func (c *MonitorComponent) Instances() []Instance
- func (c *MonitorComponent) Name() string
- func (c *MonitorComponent) Role() string
- func (c *MonitorComponent) SetVersion(version string)
- func (c *MonitorComponent) Source() string
- type MonitorInstance
- type MonitoredOptions
- type PDComponent
- type PDInstance
- func (i *PDInstance) InitConfig(ctx context.Context, e ctxt.Executor, ...) error
- func (i *PDInstance) IsLeader(ctx context.Context, topo Topology, apiTimeoutSeconds int, tlsCfg *tls.Config) (bool, error)
- func (i *PDInstance) PostRestart(ctx context.Context, topo Topology, tlsCfg *tls.Config) error
- func (i *PDInstance) PreRestart(ctx context.Context, topo Topology, apiTimeoutSeconds int, tlsCfg *tls.Config) error
- func (i *PDInstance) ScaleConfig(ctx context.Context, e ctxt.Executor, topo Topology, ...) error
- type PDSpec
- func (s *PDSpec) GetAdvertiseClientURL(enableTLS bool) string
- func (s *PDSpec) GetAdvertisePeerURL(enableTLS bool) string
- func (s *PDSpec) GetMainPort() int
- func (s *PDSpec) GetManageHost() string
- func (s *PDSpec) IgnoreMonitorAgent() bool
- func (s *PDSpec) IsImported() bool
- func (s *PDSpec) Role() string
- func (s *PDSpec) SSH() (string, int)
- func (s *PDSpec) Status(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config, _ ...string) string
- type PrometheusSpec
- type PumpComponent
- type PumpInstance
- type PumpSpec
- func (s *PumpSpec) GetMainPort() int
- func (s *PumpSpec) GetManageHost() string
- func (s *PumpSpec) IgnoreMonitorAgent() bool
- func (s *PumpSpec) IsImported() bool
- func (s *PumpSpec) Role() string
- func (s *PumpSpec) SSH() (string, int)
- func (s *PumpSpec) Status(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config, ...) string
- type Remote
- type RollingUpdateInstance
- type ScaleOutTopology
- type ServerConfigs
- type SpecManager
- func (s *SpecManager) Exist(clusterName string) (exist bool, err error)
- func (s *SpecManager) GetAllClusters() (map[string]Metadata, error)
- func (s *SpecManager) IsScaleOutLocked(clusterName string) (locked bool, err error)
- func (s *SpecManager) List() (clusterNames []string, err error)
- func (s *SpecManager) Metadata(clusterName string, meta any) error
- func (s *SpecManager) NewMetadata() Metadata
- func (s *SpecManager) NewScaleOutLock(clusterName string, topo Topology) error
- func (s *SpecManager) Path(cluster string, subpath ...string) string
- func (s *SpecManager) ReleaseScaleOutLock(clusterName string) error
- func (s *SpecManager) Remove(clusterName string) error
- func (s *SpecManager) SaveMeta(clusterName string, meta Metadata) error
- func (s *SpecManager) ScaleOutLock(clusterName string) (Topology, error)
- func (s *SpecManager) ScaleOutLockedErr(clusterName string) error
- type Specification
- func (s *Specification) AdjustByVersion(clusterVersion string)
- func (s *Specification) BaseTopo() *BaseTopo
- func (s *Specification) ComponentsByStartOrder() (comps []Component)
- func (s *Specification) ComponentsByStopOrder() (comps []Component)
- func (s *Specification) ComponentsByUpdateOrder(curVer string) (comps []Component)
- func (s *Specification) CountDir(targetHost, dirPrefix string) int
- func (s *Specification) FillHostArchOrOS(hostArch map[string]string, fullType FullHostType) error
- func (s *Specification) GetCDCListWithManageHost() []string
- func (s *Specification) GetDashboardAddress(ctx context.Context, tlsCfg *tls.Config, timeout time.Duration, ...) (string, error)
- func (s *Specification) GetEtcdClient(tlsCfg *tls.Config) (*clientv3.Client, error)
- func (s *Specification) GetEtcdProxyClient(tlsCfg *tls.Config, tcpProxy *proxy.TCPProxy) (*clientv3.Client, chan struct{}, error)
- func (s *Specification) GetGrafanaConfig() map[string]string
- func (s *Specification) GetMonitoredOptions() *MonitoredOptions
- func (s *Specification) GetPDList() []string
- func (s *Specification) GetPDListWithManageHost() []string
- func (s *Specification) GetTiKVLabels() (map[string]map[string]string, []map[string]api.LabelInfo, error)
- func (s *Specification) IterComponent(fn func(comp Component))
- func (s *Specification) IterInstance(fn func(instance Instance), concurrency ...int)
- func (s *Specification) LocationLabels() ([]string, error)
- func (s *Specification) Merge(that Topology) Topology
- func (s *Specification) MergeTopo(topo Topology) Topology
- func (s *Specification) NewPart() 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 TiDBComponent
- type TiDBInstance
- type TiDBSpec
- type TiFlashComponent
- func (c *TiFlashComponent) CalculateVersion(clusterVersion string) string
- func (c *TiFlashComponent) Instances() []Instance
- func (c *TiFlashComponent) Name() string
- func (c *TiFlashComponent) Role() string
- func (c *TiFlashComponent) SetVersion(version string)
- func (c *TiFlashComponent) Source() string
- type TiFlashInstance
- func (i *TiFlashInstance) CheckIncorrectConfigs() error
- func (i *TiFlashInstance) GetServicePort() int
- func (i *TiFlashInstance) GetStatusPort() int
- func (i *TiFlashInstance) InitConfig(ctx context.Context, e ctxt.Executor, ...) error
- func (i *TiFlashInstance) InitTiFlashLearnerConfig(ctx context.Context, clusterVersion string, src map[string]any, ...) (map[string]any, error)
- func (i *TiFlashInstance) PrepareStart(ctx context.Context, tlsCfg *tls.Config) error
- func (i *TiFlashInstance) Ready(ctx context.Context, e ctxt.Executor, timeout uint64, tlsCfg *tls.Config) error
- func (i *TiFlashInstance) ScaleConfig(ctx context.Context, e ctxt.Executor, topo Topology, ...) error
- type TiFlashSpec
- func (s *TiFlashSpec) GetExtendedRole(ctx context.Context, tlsCfg *tls.Config, pdList ...string) string
- func (s *TiFlashSpec) GetMainPort() int
- func (s *TiFlashSpec) GetManageHost() string
- func (s *TiFlashSpec) GetOverrideDataDir() (string, error)
- func (s *TiFlashSpec) IgnoreMonitorAgent() bool
- func (s *TiFlashSpec) IsImported() bool
- func (s *TiFlashSpec) Role() string
- func (s *TiFlashSpec) SSH() (string, int)
- func (s *TiFlashSpec) Status(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config, ...) string
- type TiKVCDCComponent
- func (c *TiKVCDCComponent) CalculateVersion(clusterVersion string) string
- func (c *TiKVCDCComponent) Instances() []Instance
- func (c *TiKVCDCComponent) Name() string
- func (c *TiKVCDCComponent) Role() string
- func (c *TiKVCDCComponent) SetVersion(version string)
- func (c *TiKVCDCComponent) Source() string
- type TiKVCDCInstance
- func (i *TiKVCDCInstance) InitConfig(ctx context.Context, e ctxt.Executor, ...) error
- func (i *TiKVCDCInstance) PostRestart(ctx context.Context, topo Topology, tlsCfg *tls.Config) error
- func (i *TiKVCDCInstance) PreRestart(ctx context.Context, topo Topology, apiTimeoutSeconds int, tlsCfg *tls.Config) error
- func (i *TiKVCDCInstance) ScaleConfig(ctx context.Context, e ctxt.Executor, topo Topology, ...) error
- type TiKVCDCSpec
- type TiKVComponent
- type TiKVInstance
- func (i *TiKVInstance) InitConfig(ctx context.Context, e ctxt.Executor, ...) error
- func (i *TiKVInstance) PostRestart(ctx context.Context, topo Topology, tlsCfg *tls.Config) error
- func (i *TiKVInstance) PreRestart(ctx context.Context, topo Topology, apiTimeoutSeconds int, tlsCfg *tls.Config) error
- func (i *TiKVInstance) ScaleConfig(ctx context.Context, e ctxt.Executor, topo Topology, ...) error
- type TiKVLabelError
- type TiKVLabelProvider
- type TiKVSpec
- func (s *TiKVSpec) GetMainPort() int
- func (s *TiKVSpec) GetManageHost() string
- func (s *TiKVSpec) IgnoreMonitorAgent() bool
- func (s *TiKVSpec) IsImported() bool
- func (s *TiKVSpec) Labels() (map[string]string, error)
- func (s *TiKVSpec) Role() string
- func (s *TiKVSpec) SSH() (string, int)
- func (s *TiKVSpec) Status(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config, ...) string
- type TiProxyComponent
- func (c *TiProxyComponent) CalculateVersion(clusterVersion string) string
- func (c *TiProxyComponent) Instances() []Instance
- func (c *TiProxyComponent) Name() string
- func (c *TiProxyComponent) Role() string
- func (c *TiProxyComponent) SetVersion(version string)
- func (c *TiProxyComponent) Source() string
- type TiProxyInstance
- func (i *TiProxyInstance) GetAddr() string
- func (i *TiProxyInstance) InitConfig(ctx context.Context, e ctxt.Executor, ...) error
- func (i *TiProxyInstance) PostRestart(ctx context.Context, topo Topology, tlsCfg *tls.Config) error
- func (i *TiProxyInstance) PreRestart(ctx context.Context, topo Topology, apiTimeoutSeconds int, tlsCfg *tls.Config) error
- func (i *TiProxyInstance) ScaleConfig(ctx context.Context, e ctxt.Executor, topo Topology, ...) error
- type TiProxySpec
- type TiSparkMasterComponent
- func (c *TiSparkMasterComponent) CalculateVersion(clusterVersion string) string
- func (c *TiSparkMasterComponent) Instances() []Instance
- func (c *TiSparkMasterComponent) Name() string
- func (c *TiSparkMasterComponent) Role() string
- func (c *TiSparkMasterComponent) SetVersion(version string)
- func (c *TiSparkMasterComponent) Source() string
- type TiSparkMasterInstance
- func (i *TiSparkMasterInstance) GetCustomEnvs() map[string]string
- func (i *TiSparkMasterInstance) GetCustomFields() map[string]any
- func (i *TiSparkMasterInstance) GetJavaHome() string
- func (i *TiSparkMasterInstance) InitConfig(ctx context.Context, e ctxt.Executor, ...) (err error)
- func (i *TiSparkMasterInstance) ScaleConfig(ctx context.Context, e ctxt.Executor, topo Topology, ...) error
- type TiSparkMasterSpec
- type TiSparkWorkerComponent
- func (c *TiSparkWorkerComponent) CalculateVersion(clusterVersion string) string
- func (c *TiSparkWorkerComponent) Instances() []Instance
- func (c *TiSparkWorkerComponent) Name() string
- func (c *TiSparkWorkerComponent) Role() string
- func (c *TiSparkWorkerComponent) SetVersion(version string)
- func (c *TiSparkWorkerComponent) Source() string
- type TiSparkWorkerInstance
- type TiSparkWorkerSpec
- type Topology
- type UpgradableMetadata
Constants ¶
const ( ComponentTiDB = "tidb" ComponentTiKV = "tikv" ComponentPD = "pd" ComponentTiFlash = "tiflash" ComponentTiProxy = "tiproxy" ComponentGrafana = "grafana" ComponentDrainer = "drainer" ComponentDashboard = "tidb-dashboard" ComponentPump = "pump" ComponentCDC = "cdc" ComponentTiKVCDC = "tikv-cdc" ComponentTiSpark = "tispark" ComponentSpark = "spark" ComponentAlertmanager = "alertmanager" ComponentDMMaster = "dm-master" ComponentDMWorker = "dm-worker" ComponentPrometheus = "prometheus" ComponentBlackboxExporter = "blackbox_exporter" ComponentNodeExporter = "node_exporter" ComponentCheckCollector = "insight" )
Components names
const ( TiUPPackageCacheDir = "packages" TiUPClusterDir = "clusters" TiUPAuditDir = "audit" TLSCertKeyDir = "tls" TLSCertKeyDirWithAnsible = "ssl" TLSCACert = "ca.crt" TLSCAKey = "ca.pem" TLSClientCert = "client.crt" TLSClientKey = "client.pem" PFXClientCert = "client.pfx" )
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" // ScaleOutLockName scale_out snapshot file, like file lock ScaleOutLockName = ".scale-out.yaml" )
const ( // EngineLabelKey is the label that indicates the backend of store instance: // tikv or tiflash. TiFlash instance will contain a label of 'engine: tiflash'. EngineLabelKey = "engine" // EngineLabelTiFlash is the label value, which a TiFlash instance will have with // a label key of EngineLabelKey. EngineLabelTiFlash = "tiflash" // EngineLabelTiFlashCompute is for disaggregated tiflash mode, // it's the lable of tiflash_compute nodes. EngineLabelTiFlashCompute = "tiflash_compute" // EngineRoleLabelKey is the label that indicates if the TiFlash instance is a write node. EngineRoleLabelKey = "engine_role" // EngineRoleLabelWrite is for disaggregated tiflash write node. EngineRoleLabelWrite = "write" )
const ( TiFlashStorageKeyMainDirs string = "storage.main.dir" TiFlashStorageKeyLatestDirs string = "storage.latest.dir" TiFlashStorageKeyRaftDirs string = "storage.raft.dir" TiFlashRemoteCacheDir string = "storage.remote.cache.dir" TiFlashRequiredCPUFlags string = "avx2 popcnt movbe" )
key names for storage config
Variables ¶
var ( // ErrTopologyReadFailed is ErrTopologyReadFailed ErrTopologyReadFailed = errNSTopolohy.NewType("read_failed", utils.ErrTraitPreCheck) // ErrTopologyParseFailed is ErrTopologyParseFailed ErrTopologyParseFailed = errNSTopolohy.NewType("parse_failed", utils.ErrTraitPreCheck) )
var ( RoleMonitor = "monitor" RoleTiSparkMaster = "tispark-master" RoleTiSparkWorker = "tispark-worker" TopoTypeTiDB = "tidb-cluster" TopoTypeDM = "dm-cluster" )
general role names
var ( // ErrCreateDirFailed is ErrCreateDirFailed ErrCreateDirFailed = errNS.NewType("create_dir_failed") // ErrSaveMetaFailed is ErrSaveMetaFailed ErrSaveMetaFailed = errNS.NewType("save_meta_failed") // ErrSaveScaleOutFileFailed is ErrSaveMetaFailed ErrSaveScaleOutFileFailed = errNS.NewType("save_scale-out_lock_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") ErrUserOrGroupInvalid = errors.New(`linux username and groupname must start with a lower case letter or an underscore, ` + `followed by lower case letters, digits, underscores, or dashes. ` + `Usernames may only be up to 32 characters long. ` + `Groupnames may only be up to 16 characters long.`) )
pre defined error types
var ( // CopyConfigFile is the checkpoint to cache config file transfer action CopyConfigFile = checkpoint.Register( checkpoint.Field("config-file", reflect.DeepEqual), ) )
var ErrorCheckConfig = errors.New("check config failed")
ErrorCheckConfig represent error occurred in config check stage
Functions ¶
func AllComponentNames ¶
func AllComponentNames() (roles []string)
AllComponentNames contains the names of all components. should include all components in ComponentsByStartOrder
func AuditDir ¶ added in v1.0.9
func AuditDir() string
AuditDir return the directory for saving audit log.
func CheckClusterDirConflict ¶ added in v1.1.0
func CheckClusterDirConflict(clusterList map[string]Metadata, clusterName string, topo Topology) error
CheckClusterDirConflict checks cluster dir conflict or overlap
func CheckClusterDirOverlap ¶ added in v1.4.0
CheckClusterDirOverlap checks cluster dir overlaps with data or log. this should only be used across clusters. we don't allow to deploy log under data, and vise versa. ref https://github.com/pingcap/tiup/issues/1047#issuecomment-761711508
func CheckClusterPortConflict ¶ added in v1.1.0
func CheckClusterPortConflict(clusterList map[string]Metadata, clusterName string, topo Topology) error
CheckClusterPortConflict checks cluster port conflict
func CheckTiKVLabels ¶ added in v1.2.3
func CheckTiKVLabels(pdLocLabels []string, slp TiKVLabelProvider) error
CheckTiKVLabels will check if tikv missing label or have wrong label
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 ExpandRelativeDir ¶ added in v1.2.0
func ExpandRelativeDir(topo Topology)
ExpandRelativeDir fill DeployDir, DataDir and LogDir to absolute path
func FillHostArchOrOS ¶ added in v1.10.0
func FillHostArchOrOS(s any, hostArchOrOS map[string]string, fullType FullHostType) error
FillHostArchOrOS fills the topology with the given host->arch
func FlattenMap ¶ added in v1.3.0
FlattenMap convert mutil-layer map to single layer
func GetDMMasterPackageName ¶ added in v1.13.0
GetDMMasterPackageName return package name of the first DMMaster instance
func GetValueFromPath ¶ added in v1.2.0
GetValueFromPath try to find the value by path recursively
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/.tiup` of current user is used. The directory will be created before return if it does not already exist.
func LoadClientCert ¶ added in v1.2.0
LoadClientCert read and load the client cert key pair and CA cert
func Merge2Toml ¶ added in v1.0.8
Merge2Toml merge the config of global.
func MergeConfig ¶ added in v1.4.1
MergeConfig merge two or more config into one and unflat them config1:
a.b.a: 1 a.b.b: 2
config2:
a.b.a: 3 a.b.c: 4
config3:
b.c = 5
After MergeConfig(config1, config2, config3):
a: b: a: 3 b: 2 c: 4 b: c: 5
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 MultiDirAbs ¶ added in v1.2.0
MultiDirAbs returns the absolute path for multi-dir separated by comma
func PackagePath ¶ added in v1.3.0
PackagePath return the tar bar path
func ParseTopologyYaml ¶ added in v1.2.0
ParseTopologyYaml read yaml content from `file` and unmarshal it to `out` ignoreGlobal ignore global variables in file, only ignoreGlobal with a index of 0 is effective
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 TiUP.
func ProfilePath ¶
ProfilePath joins a path under the profile dir
func ReadYamlFile ¶ added in v1.5.0
ReadYamlFile read yaml content from file`
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
Types ¶
type AlertManagerComponent ¶
type AlertManagerComponent struct{ Topology }
AlertManagerComponent represents Alertmanager component.
func (*AlertManagerComponent) CalculateVersion ¶ added in v1.14.0
func (c *AlertManagerComponent) CalculateVersion(_ string) string
CalculateVersion implements the Component interface
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.
func (*AlertManagerComponent) SetVersion ¶ added in v1.14.0
func (c *AlertManagerComponent) SetVersion(version string)
SetVersion implements Component interface.
func (*AlertManagerComponent) Source ¶ added in v1.14.0
func (c *AlertManagerComponent) Source() string
Source implements Component interface.
type AlertManagerInstance ¶
type AlertManagerInstance struct { BaseInstance // contains filtered or unexported fields }
AlertManagerInstance represent the alert manager instance
type AlertmanagerSpec ¶ added in v1.3.0
type AlertmanagerSpec 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"` WebPort int `yaml:"web_port" default:"9093"` ClusterPort int `yaml:"cluster_port" default:"9094"` ListenHost string `yaml:"listen_host,omitempty" validate:"listen_host:editable"` 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 ¶ added in v1.3.0
func (s *AlertmanagerSpec) GetMainPort() int
GetMainPort returns the main port of the instance
func (*AlertmanagerSpec) GetManageHost ¶ added in v1.12.3
func (s *AlertmanagerSpec) GetManageHost() string
GetManageHost returns the manage host of the instance
func (*AlertmanagerSpec) IgnoreMonitorAgent ¶ added in v1.6.0
func (s *AlertmanagerSpec) IgnoreMonitorAgent() bool
IgnoreMonitorAgent returns if the node does not have monitor agents available
func (*AlertmanagerSpec) IsImported ¶ added in v1.3.0
func (s *AlertmanagerSpec) IsImported() bool
IsImported returns if the node is imported from TiDB-Ansible
func (*AlertmanagerSpec) Role ¶ added in v1.3.0
func (s *AlertmanagerSpec) Role() string
Role returns the component role of the instance
func (*AlertmanagerSpec) SSH ¶ added in v1.3.0
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 ManageHost string ListenHost string Port int SSHP int Source string NumaNode string NumaCores string Ports []int Dirs []string StatusFn func(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config, pdHosts ...string) string UptimeFn func(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config) time.Duration Component Component }
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) CalculateVersion ¶ added in v1.14.0
func (i *BaseInstance) CalculateVersion(globalVersion string) string
CalculateVersion implements the Instance interface
func (*BaseInstance) ComponentName ¶ added in v1.1.0
func (i *BaseInstance) ComponentName() string
ComponentName implements Instance interface
func (*BaseInstance) ComponentSource ¶ added in v1.13.0
func (i *BaseInstance) ComponentSource() string
ComponentSource 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) GetManageHost ¶ added in v1.12.0
func (i *BaseInstance) GetManageHost() string
GetManageHost implements Instance interface
func (*BaseInstance) GetNumaCores ¶ added in v1.14.0
func (i *BaseInstance) GetNumaCores() string
GetNumaCores implements Instance interface
func (*BaseInstance) GetNumaNode ¶ added in v1.14.0
func (i *BaseInstance) GetNumaNode() string
GetNumaNode 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(ctx context.Context, e ctxt.Executor, opt GlobalOptions, user string, paths meta.DirPaths) (err 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) IsPatched ¶ added in v1.4.0
func (i *BaseInstance) IsPatched() bool
IsPatched implements Instance interface
func (*BaseInstance) IteratorLocalConfigDir ¶ added in v1.4.0
func (i *BaseInstance) IteratorLocalConfigDir(ctx context.Context, local string, filter func(string) bool, f func(string) error) error
IteratorLocalConfigDir iterators the local dir with filter, then invoke f for each found fileName
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(ctx context.Context, e ctxt.Executor, globalConf, instanceConf map[string]any, 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
PrepareStart checks instance requirements before starting
func (*BaseInstance) Ready ¶ added in v1.1.0
func (i *BaseInstance) Ready(ctx context.Context, e ctxt.Executor, timeout uint64, _ *tls.Config) error
Ready implements Instance interface
func (*BaseInstance) ResourceControl ¶ added in v1.11.0
func (i *BaseInstance) ResourceControl() meta.ResourceControl
ResourceControl return cgroups config of instance
func (*BaseInstance) ServiceName ¶ added in v1.1.0
func (i *BaseInstance) ServiceName() string
ServiceName implements Instance interface
func (*BaseInstance) SetPatched ¶ added in v1.4.0
func (i *BaseInstance) SetPatched(p bool)
SetPatched implements the Instance interface
func (*BaseInstance) Status ¶ added in v1.1.0
func (i *BaseInstance) Status(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config, pdList ...string) string
Status implements Instance interface
func (*BaseInstance) TLSDir ¶ added in v1.9.0
func (i *BaseInstance) TLSDir() string
TLSDir implements Instance interface
func (*BaseInstance) TransferLocalConfigDir ¶ added in v1.1.0
func (i *BaseInstance) TransferLocalConfigDir(ctx context.Context, e ctxt.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(ctx context.Context, e ctxt.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) Uptime ¶ added in v1.5.0
func (i *BaseInstance) Uptime(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config) time.Duration
Uptime implements Instance interface
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 PrometheusVersion *string GrafanaVersion *string AlertManagerVersion *string Monitors []*PrometheusSpec Grafanas []*GrafanaSpec Alertmanagers []*AlertmanagerSpec }
BaseTopo is the base info to topology.
type CDCComponent ¶
type CDCComponent struct{ Topology *Specification }
CDCComponent represents CDC component.
func (*CDCComponent) CalculateVersion ¶ added in v1.14.0
func (c *CDCComponent) CalculateVersion(clusterVersion string) string
CalculateVersion implements the Component interface
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.
func (*CDCComponent) SetVersion ¶ added in v1.14.0
func (c *CDCComponent) SetVersion(version string)
SetVersion implements Component interface.
func (*CDCComponent) Source ¶ added in v1.14.0
func (c *CDCComponent) Source() string
Source implements Component interface.
type CDCInstance ¶
type CDCInstance struct { BaseInstance // contains filtered or unexported fields }
CDCInstance represent the CDC instance.
func (*CDCInstance) GetAddr ¶ added in v1.11.0
func (i *CDCInstance) GetAddr() string
GetAddr return the address of this TiCDC instance
func (*CDCInstance) InitConfig ¶
func (i *CDCInstance) InitConfig( ctx context.Context, e ctxt.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths, ) error
InitConfig implements Instance interface.
func (*CDCInstance) PostRestart ¶ added in v1.11.0
PostRestart implements RollingUpdateInstance interface.
func (*CDCInstance) PreRestart ¶ added in v1.11.0
func (i *CDCInstance) PreRestart(ctx context.Context, topo Topology, apiTimeoutSeconds int, tlsCfg *tls.Config) error
PreRestart implements RollingUpdateInstance interface. All errors are ignored, to trigger hard restart.
type CDCSpec ¶
type CDCSpec 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"` Port int `yaml:"port" default:"8300"` DeployDir string `yaml:"deploy_dir,omitempty"` DataDir string `yaml:"data_dir,omitempty"` LogDir string `yaml:"log_dir,omitempty"` Offline bool `yaml:"offline,omitempty"` GCTTL int64 `yaml:"gc-ttl,omitempty" validate:"gc-ttl:editable"` TZ string `yaml:"tz,omitempty" validate:"tz:editable"` TiCDCClusterID string `yaml:"ticdc_cluster_id"` 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 meta.ResourceControl `yaml:"resource_control,omitempty" validate:"resource_control:editable"` Arch string `yaml:"arch,omitempty"` OS string `yaml:"os,omitempty"` }
CDCSpec represents the CDC topology specification in topology.yaml
func (*CDCSpec) GetMainPort ¶
GetMainPort returns the main port of the instance
func (*CDCSpec) GetManageHost ¶ added in v1.12.3
GetManageHost returns the manage host of the instance
func (*CDCSpec) IgnoreMonitorAgent ¶ added in v1.6.0
IgnoreMonitorAgent returns if the node does not have monitor agents available
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 // EnableFirewall bool `yaml:"firewall"` OpsVer string `yaml:"last_ops_ver,omitempty"` // the version of ourself that updated the meta last time Topology *Specification `yaml:"topology"` }
ClusterMeta is the specification of generic cluster metadata
func ClusterMetadata ¶
func ClusterMetadata(clusterName string) (*ClusterMeta, error)
ClusterMetadata tries to read the metadata of a cluster from file
func (*ClusterMeta) GetBaseMeta ¶ added in v1.0.9
func (m *ClusterMeta) GetBaseMeta() *BaseMeta
GetBaseMeta implements Metadata interface.
func (*ClusterMeta) GetTopology ¶ added in v1.0.9
func (m *ClusterMeta) GetTopology() Topology
GetTopology implement Metadata interface.
func (*ClusterMeta) SetTopology ¶ added in v1.0.9
func (m *ClusterMeta) SetTopology(topo Topology)
SetTopology implement Metadata interface.
func (*ClusterMeta) SetUser ¶ added in v1.0.9
func (m *ClusterMeta) SetUser(s string)
SetUser implement UpgradableMetadata interface.
func (*ClusterMeta) SetVersion ¶ added in v1.0.9
func (m *ClusterMeta) SetVersion(s string)
SetVersion implement UpgradableMetadata interface.
type Component ¶
type Component interface { Name() string Role() string Source() string Instances() []Instance CalculateVersion(string) string SetVersion(string) }
Component represents a component of the cluster.
func FindComponent ¶ added in v1.2.0
FindComponent returns the Component corresponding the name
type ComponentSources ¶ added in v1.14.0
type ComponentSources struct { TiDB string `yaml:"tidb,omitempty" validate:"tidb:editable"` TiKV string `yaml:"tikv,omitempty" validate:"tikv:editable"` TiFlash string `yaml:"tiflash,omitempty" validate:"tiflash:editable"` PD string `yaml:"pd,omitempty" validate:"pd:editable"` Dashboard string `yaml:"tidb_dashboard,omitempty" validate:"tidb_dashboard:editable"` Pump string `yaml:"pump,omitempty" validate:"pump:editable"` Drainer string `yaml:"drainer,omitempty" validate:"drainer:editable"` CDC string `yaml:"cdc,omitempty" validate:"cdc:editable"` TiKVCDC string `yaml:"kvcdc,omitempty" validate:"kvcdc:editable"` }
ComponentSources represents the source of components
type ComponentVersions ¶ added in v1.14.0
type ComponentVersions struct { TiDB string `yaml:"tidb,omitempty"` TiKV string `yaml:"tikv,omitempty"` TiFlash string `yaml:"tiflash,omitempty"` PD string `yaml:"pd,omitempty"` Dashboard string `yaml:"tidb_dashboard,omitempty"` Pump string `yaml:"pump,omitempty"` Drainer string `yaml:"drainer,omitempty"` CDC string `yaml:"cdc,omitempty"` TiKVCDC string `yaml:"kvcdc,omitempty"` TiProxy string `yaml:"tiproxy,omitempty"` Prometheus string `yaml:"prometheus,omitempty"` Grafana string `yaml:"grafana,omitempty"` AlertManager string `yaml:"alertmanager,omitempty"` }
ComponentVersions represents the versions of components
func (*ComponentVersions) Merge ¶ added in v1.14.0
func (v *ComponentVersions) Merge(that ComponentVersions) ComponentVersions
Merge returns a new ComponentVersions which sum old ones
type DashboardComponent ¶ added in v1.11.0
type DashboardComponent struct{ Topology *Specification }
DashboardComponent represents Drainer component.
func (*DashboardComponent) CalculateVersion ¶ added in v1.14.0
func (c *DashboardComponent) CalculateVersion(clusterVersion string) string
CalculateVersion implements the Component interface
func (*DashboardComponent) Instances ¶ added in v1.11.0
func (c *DashboardComponent) Instances() []Instance
Instances implements Component interface.
func (*DashboardComponent) Name ¶ added in v1.11.0
func (c *DashboardComponent) Name() string
Name implements Component interface.
func (*DashboardComponent) Role ¶ added in v1.11.0
func (c *DashboardComponent) Role() string
Role implements Component interface.
func (*DashboardComponent) SetVersion ¶ added in v1.14.0
func (c *DashboardComponent) SetVersion(version string)
SetVersion implements Component interface.
func (*DashboardComponent) Source ¶ added in v1.14.0
func (c *DashboardComponent) Source() string
Source implements Component interface.
type DashboardInstance ¶ added in v1.11.0
type DashboardInstance struct { BaseInstance // contains filtered or unexported fields }
DashboardInstance represent the Ddashboard instance.
type DashboardSpec ¶ added in v1.11.0
type DashboardSpec 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"` Patched bool `yaml:"patched,omitempty"` IgnoreExporter bool `yaml:"ignore_exporter,omitempty"` Port int `yaml:"port" default:"12333"` 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 meta.ResourceControl `yaml:"resource_control,omitempty" validate:"resource_control:editable"` Arch string `yaml:"arch,omitempty"` OS string `yaml:"os,omitempty"` }
DashboardSpec represents the Dashboard topology specification in topology.yaml
func (*DashboardSpec) GetMainPort ¶ added in v1.11.0
func (s *DashboardSpec) GetMainPort() int
GetMainPort returns the main port of the instance
func (*DashboardSpec) GetManageHost ¶ added in v1.12.3
func (s *DashboardSpec) GetManageHost() string
GetManageHost returns the manage host of the instance
func (*DashboardSpec) IgnoreMonitorAgent ¶ added in v1.11.0
func (s *DashboardSpec) IgnoreMonitorAgent() bool
IgnoreMonitorAgent returns if the node does not have monitor agents available
func (*DashboardSpec) IsImported ¶ added in v1.11.0
func (s *DashboardSpec) IsImported() bool
IsImported returns if the node is imported from TiDB-Ansible
func (*DashboardSpec) Role ¶ added in v1.11.0
func (s *DashboardSpec) Role() string
Role returns the component role of the instance
func (*DashboardSpec) SSH ¶ added in v1.11.0
func (s *DashboardSpec) SSH() (string, int)
SSH returns the host and SSH port of the instance
type DirAccessor ¶ added in v1.4.0
type DirAccessor struct {
// contains filtered or unexported fields
}
DirAccessor stands for a directory accessor for an instance
type DirEntry ¶ added in v1.4.0
type DirEntry struct {
// contains filtered or unexported fields
}
DirEntry stands for a directory with attributes and instance
type DrainerComponent ¶
type DrainerComponent struct{ Topology *Specification }
DrainerComponent represents Drainer component.
func (*DrainerComponent) CalculateVersion ¶ added in v1.14.0
func (c *DrainerComponent) CalculateVersion(clusterVersion string) string
CalculateVersion implements the Component interface
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.
func (*DrainerComponent) SetVersion ¶ added in v1.14.0
func (c *DrainerComponent) SetVersion(version string)
SetVersion implements Component interface.
func (*DrainerComponent) Source ¶ added in v1.14.0
func (c *DrainerComponent) Source() string
Source implements Component interface.
type DrainerInstance ¶
type DrainerInstance struct { BaseInstance // contains filtered or unexported fields }
DrainerInstance represent the Drainer instance.
type DrainerSpec ¶
type DrainerSpec 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"` 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" validate:"commit_ts:editable"` // do not use it anymore, exist for compatibility Offline bool `yaml:"offline,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 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) GetManageHost ¶ added in v1.12.3
func (s *DrainerSpec) GetManageHost() string
GetManageHost returns the manage host of the instance
func (*DrainerSpec) IgnoreMonitorAgent ¶ added in v1.6.0
func (s *DrainerSpec) IgnoreMonitorAgent() bool
IgnoreMonitorAgent returns if the node does not have monitor agents available
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 ExternalAlertmanager ¶ added in v1.4.0
type ExternalAlertmanager struct { Host string `yaml:"host"` WebPort int `yaml:"web_port" default:"9093"` }
ExternalAlertmanager configs prometheus to include alertmanagers not deployed in current cluster
type FullHostType ¶ added in v1.10.0
type FullHostType string
FullHostType is the type of fullhost operations
const ( // FullArchType cpu-arch type FullArchType FullHostType = "Arch" // FullOSType kernel-name FullOSType FullHostType = "OS" )
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"` SSHType executor.SSHType `yaml:"ssh_type,omitempty" default:"builtin"` TLSEnabled bool `yaml:"enable_tls,omitempty"` ListenHost string `yaml:"listen_host,omitempty" validate:"listen_host: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"` Custom any `yaml:"custom,omitempty" validate:"custom:ignore"` }
GlobalOptions represents the global options for all groups in topology specification in topology.yaml
type GrafanaComponent ¶
type GrafanaComponent struct{ Topology }
GrafanaComponent represents Grafana component.
func (*GrafanaComponent) CalculateVersion ¶ added in v1.14.0
func (c *GrafanaComponent) CalculateVersion(clusterVersion string) string
CalculateVersion implements the Component interface
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.
func (*GrafanaComponent) SetVersion ¶ added in v1.14.0
func (c *GrafanaComponent) SetVersion(version string)
SetVersion implements Component interface.
func (*GrafanaComponent) Source ¶ added in v1.14.0
func (c *GrafanaComponent) Source() string
Source implements Component interface.
type GrafanaInstance ¶
type GrafanaInstance struct { BaseInstance // contains filtered or unexported fields }
GrafanaInstance represent the grafana instance
type GrafanaSpec ¶
type GrafanaSpec 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"` Port int `yaml:"port" default:"3000"` DeployDir string `yaml:"deploy_dir,omitempty"` Config map[string]string `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"` DashboardDir string `yaml:"dashboard_dir,omitempty" validate:"dashboard_dir:editable"` Username string `yaml:"username,omitempty" default:"admin" validate:"username:editable"` Password string `yaml:"password,omitempty" default:"admin" validate:"password:editable"` AnonymousEnable bool `yaml:"anonymous_enable" default:"false" validate:"anonymous_enable:editable"` RootURL string `yaml:"root_url" validate:"root_url:editable"` Domain string `yaml:"domain" validate:"domain:editable"` DefaultTheme string `yaml:"default_theme,omitempty" validate:"default_theme:editable"` OrgName string `yaml:"org_name,omitempty" validate:"org_name:editable"` OrgRole string `yaml:"org_role,omitempty" validate:"org_role: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) GetManageHost ¶ added in v1.12.3
func (s *GrafanaSpec) GetManageHost() string
GetManageHost returns the manage host of the instance
func (*GrafanaSpec) IgnoreMonitorAgent ¶ added in v1.6.0
func (s *GrafanaSpec) IgnoreMonitorAgent() bool
IgnoreMonitorAgent returns if the node does not have monitor agents available
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(context.Context, ctxt.Executor, uint64, *tls.Config) error InitConfig(ctx context.Context, e ctxt.Executor, clusterName string, clusterVersion string, deployUser string, paths meta.DirPaths) error ScaleConfig(ctx context.Context, e ctxt.Executor, topo Topology, clusterName string, clusterVersion string, deployUser string, paths meta.DirPaths) error PrepareStart(ctx context.Context, tlsCfg *tls.Config) error ComponentName() string ComponentSource() string InstanceName() string ServiceName() string ResourceControl() meta.ResourceControl GetHost() string GetManageHost() string GetPort() int GetSSHPort() int GetNumaNode() string GetNumaCores() string DeployDir() string UsedPorts() []int UsedDirs() []string Status(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config, pdList ...string) string Uptime(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config) time.Duration DataDir() string LogDir() string OS() string // only linux supported now Arch() string IsPatched() bool SetPatched(bool) CalculateVersion(string) string // contains filtered or unexported methods }
Instance represents the instance.
type InstanceSpec ¶
type InstanceSpec interface { Role() string SSH() (string, int) GetMainPort() int IsImported() bool IgnoreMonitorAgent() 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{ Topology }
MonitorComponent represents Monitor component.
func (*MonitorComponent) CalculateVersion ¶ added in v1.14.0
func (c *MonitorComponent) CalculateVersion(clusterVersion string) string
CalculateVersion implements the Component interface
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.
func (*MonitorComponent) SetVersion ¶ added in v1.14.0
func (c *MonitorComponent) SetVersion(version string)
SetVersion implements Component interface.
func (*MonitorComponent) Source ¶ added in v1.14.0
func (c *MonitorComponent) Source() string
Source implements Component interface.
type MonitorInstance ¶
type MonitorInstance struct { BaseInstance // contains filtered or unexported fields }
MonitorInstance represent the monitor instance
type MonitoredOptions ¶
type MonitoredOptions struct { NodeExporterPort int `yaml:"node_exporter_port,omitempty" default:"9100"` BlackboxExporterPort int `yaml:"blackbox_exporter_port,omitempty" default:"9115"` NodeExporterVersion string `yaml:"node_exporter_version,omitempty"` BlackboxExporterVersion string `yaml:"blackbox_exporter_version,omitempty"` 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{ Topology *Specification }
PDComponent represents PD component.
func (*PDComponent) CalculateVersion ¶ added in v1.14.0
func (c *PDComponent) CalculateVersion(clusterVersion string) string
CalculateVersion implements the Component interface
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.
func (*PDComponent) SetVersion ¶ added in v1.14.0
func (c *PDComponent) SetVersion(version string)
SetVersion implements Component interface.
func (*PDComponent) Source ¶ added in v1.14.0
func (c *PDComponent) Source() string
Source 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( ctx context.Context, e ctxt.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths, ) error
InitConfig implement Instance interface
func (*PDInstance) IsLeader ¶ added in v1.4.0
func (i *PDInstance) IsLeader(ctx context.Context, topo Topology, apiTimeoutSeconds int, tlsCfg *tls.Config) (bool, error)
IsLeader checks if the instance is PD leader
func (*PDInstance) PostRestart ¶ added in v1.0.9
PostRestart implements RollingUpdateInstance interface.
func (*PDInstance) PreRestart ¶ added in v1.0.9
func (i *PDInstance) PreRestart(ctx context.Context, topo Topology, apiTimeoutSeconds int, tlsCfg *tls.Config) error
PreRestart implements RollingUpdateInstance interface.
type PDSpec ¶
type PDSpec struct { Host string `yaml:"host"` ManageHost string `yaml:"manage_host,omitempty" validate:"manage_host:editable"` ListenHost string `yaml:"listen_host,omitempty"` AdvertiseClientAddr string `yaml:"advertise_client_addr,omitempty"` AdvertisePeerAddr string `yaml:"advertise_peer_addr,omitempty"` 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"` 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"` 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 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) GetAdvertiseClientURL ¶ added in v1.12.0
GetAdvertiseClientURL returns AdvertiseClientURL
func (*PDSpec) GetAdvertisePeerURL ¶ added in v1.12.0
GetAdvertisePeerURL returns AdvertisePeerURL
func (*PDSpec) GetMainPort ¶
GetMainPort returns the main port of the instance
func (*PDSpec) GetManageHost ¶ added in v1.12.3
GetManageHost returns the manage host of the instance
func (*PDSpec) IgnoreMonitorAgent ¶ added in v1.6.0
IgnoreMonitorAgent returns if the node does not have monitor agents available
func (*PDSpec) IsImported ¶
IsImported returns if the node is imported from TiDB-Ansible
type PrometheusSpec ¶
type PrometheusSpec 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"` Port int `yaml:"port" default:"9090"` NgPort int `yaml:"ng_port,omitempty" validate:"ng_port:editable"` // ng_port is usable since v5.3.0 and default as 12020 since v5.4.0, so the default value is set in spec.go/AdjustByVersion 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"` RemoteConfig Remote `yaml:"remote_config,omitempty" validate:"remote_config:ignore"` ExternalAlertmanagers []ExternalAlertmanager `yaml:"external_alertmanagers" validate:"external_alertmanagers:ignore"` PushgatewayAddrs []string `yaml:"pushgateway_addrs,omitempty" validate:"pushgateway_addrs:ignore"` 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"` AdditionalScrapeConf map[string]any `yaml:"additional_scrape_conf,omitempty" validate:"additional_scrape_conf:ignore"` ScrapeInterval string `yaml:"scrape_interval,omitempty" validate:"scrape_interval:editable"` ScrapeTimeout string `yaml:"scrape_timeout,omitempty" validate:"scrape_timeout: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) GetManageHost ¶ added in v1.12.3
func (s *PrometheusSpec) GetManageHost() string
GetManageHost returns the manage host of the instance
func (*PrometheusSpec) IgnoreMonitorAgent ¶ added in v1.6.0
func (s *PrometheusSpec) IgnoreMonitorAgent() bool
IgnoreMonitorAgent returns if the node does not have monitor agents available
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{ Topology *Specification }
PumpComponent represents Pump component.
func (*PumpComponent) CalculateVersion ¶ added in v1.14.0
func (c *PumpComponent) CalculateVersion(clusterVersion string) string
CalculateVersion implements the Component interface
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.
func (*PumpComponent) SetVersion ¶ added in v1.14.0
func (c *PumpComponent) SetVersion(version string)
SetVersion implements Component interface.
func (*PumpComponent) Source ¶ added in v1.14.0
func (c *PumpComponent) Source() string
Source implements Component interface.
type PumpInstance ¶
type PumpInstance struct { BaseInstance // contains filtered or unexported fields }
PumpInstance represent the Pump instance.
type PumpSpec ¶
type PumpSpec 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"` 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"` 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 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) GetManageHost ¶ added in v1.12.3
GetManageHost returns the manage host of the instance
func (*PumpSpec) IgnoreMonitorAgent ¶ added in v1.6.0
IgnoreMonitorAgent returns if the node does not have monitor agents available
func (*PumpSpec) IsImported ¶
IsImported returns if the node is imported from TiDB-Ansible
type Remote ¶ added in v1.4.0
type Remote struct { RemoteWrite []map[string]any `yaml:"remote_write,omitempty" validate:"remote_write:ignore"` RemoteRead []map[string]any `yaml:"remote_read,omitempty" validate:"remote_read:ignore"` }
Remote prometheus remote config
type RollingUpdateInstance ¶ added in v1.0.9
type RollingUpdateInstance interface { PreRestart(ctx context.Context, topo Topology, apiTimeoutSeconds int, tlsCfg *tls.Config) error PostRestart(ctx context.Context, topo Topology, tlsCfg *tls.Config) 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]any `yaml:"tidb"` TiKV map[string]any `yaml:"tikv"` PD map[string]any `yaml:"pd"` Dashboard map[string]any `yaml:"tidb_dashboard"` TiFlash map[string]any `yaml:"tiflash"` TiProxy map[string]any `yaml:"tiproxy"` TiFlashLearner map[string]any `yaml:"tiflash-learner"` Pump map[string]any `yaml:"pump"` Drainer map[string]any `yaml:"drainer"` CDC map[string]any `yaml:"cdc"` TiKVCDC map[string]any `yaml:"kvcdc"` Grafana map[string]string `yaml:"grafana"` }
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(clusterName 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) IsScaleOutLocked ¶ added in v1.8.0
func (s *SpecManager) IsScaleOutLocked(clusterName string) (locked bool, err error)
IsScaleOutLocked: judge the cluster scale-out file lock status
func (*SpecManager) List ¶ added in v1.0.9
func (s *SpecManager) List() (clusterNames []string, err error)
List return the cluster names.
func (*SpecManager) Metadata ¶ added in v1.0.9
func (s *SpecManager) Metadata(clusterName string, meta any) 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) NewScaleOutLock ¶ added in v1.8.0
func (s *SpecManager) NewScaleOutLock(clusterName string, topo Topology) error
NewScaleOutLock save the meta with specified cluster name.
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) ReleaseScaleOutLock ¶ added in v1.8.0
func (s *SpecManager) ReleaseScaleOutLock(clusterName string) error
ReleaseScaleOutLock remove the scale-out file lock with specified cluster
func (*SpecManager) Remove ¶ added in v1.0.9
func (s *SpecManager) Remove(clusterName string) error
Remove remove the data with specified cluster name.
func (*SpecManager) SaveMeta ¶ added in v1.0.9
func (s *SpecManager) SaveMeta(clusterName string, meta Metadata) error
SaveMeta save the meta with specified cluster name.
func (*SpecManager) ScaleOutLock ¶ added in v1.8.0
func (s *SpecManager) ScaleOutLock(clusterName string) (Topology, error)
ScaleOutLock tries to read the ScaleOutLock of a cluster from file
func (*SpecManager) ScaleOutLockedErr ¶ added in v1.8.0
func (s *SpecManager) ScaleOutLockedErr(clusterName string) error
ScaleOutLockedErr: Determine whether there is a lock, and report an error if it exists
type Specification ¶
type Specification struct { GlobalOptions GlobalOptions `yaml:"global,omitempty" validate:"global:editable"` MonitoredOptions MonitoredOptions `yaml:"monitored,omitempty" validate:"monitored:editable"` ComponentVersions ComponentVersions `yaml:"component_versions,omitempty" validate:"component_versions:editable"` ComponentSources ComponentSources `yaml:"component_sources,omitempty" validate:"component_sources: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"` TiProxyServers []*TiProxySpec `yaml:"tiproxy_servers"` PDServers []*PDSpec `yaml:"pd_servers"` DashboardServers []*DashboardSpec `yaml:"tidb_dashboard_servers,omitempty"` PumpServers []*PumpSpec `yaml:"pump_servers,omitempty"` Drainers []*DrainerSpec `yaml:"drainer_servers,omitempty"` CDCServers []*CDCSpec `yaml:"cdc_servers,omitempty"` TiKVCDCServers []*TiKVCDCSpec `yaml:"kvcdc_servers,omitempty"` TiSparkMasters []*TiSparkMasterSpec `yaml:"tispark_masters,omitempty"` TiSparkWorkers []*TiSparkWorkerSpec `yaml:"tispark_workers,omitempty"` Monitors []*PrometheusSpec `yaml:"monitoring_servers"` Grafanas []*GrafanaSpec `yaml:"grafana_servers,omitempty"` Alertmanagers []*AlertmanagerSpec `yaml:"alertmanager_servers,omitempty"` }
Specification represents the specification of topology.yaml
func (*Specification) AdjustByVersion ¶ added in v1.5.0
func (s *Specification) AdjustByVersion(clusterVersion string)
AdjustByVersion modify the spec by cluster version.
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(curVer string) (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) FillHostArchOrOS ¶ added in v1.10.0
func (s *Specification) FillHostArchOrOS(hostArch map[string]string, fullType FullHostType) error
FillHostArchOrOS fills the topology with the given host->arch
func (*Specification) GetCDCListWithManageHost ¶ added in v1.12.3
func (s *Specification) GetCDCListWithManageHost() []string
GetCDCListWithManageHost returns a list of CDC API hosts of the current cluster
func (*Specification) GetDashboardAddress ¶ added in v1.3.1
func (s *Specification) GetDashboardAddress(ctx context.Context, tlsCfg *tls.Config, timeout time.Duration, pdList ...string) (string, error)
GetDashboardAddress returns the cluster's dashboard addr
func (*Specification) GetEtcdClient ¶
GetEtcdClient loads EtcdClient of current cluster
func (*Specification) GetEtcdProxyClient ¶ added in v1.6.0
func (s *Specification) GetEtcdProxyClient(tlsCfg *tls.Config, tcpProxy *proxy.TCPProxy) (*clientv3.Client, chan struct{}, error)
GetEtcdProxyClient loads EtcdClient of current cluster with TCP proxy
func (*Specification) GetGrafanaConfig ¶ added in v1.9.0
func (s *Specification) GetGrafanaConfig() map[string]string
GetGrafanaConfig returns global grafana configurations
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) GetPDListWithManageHost ¶ added in v1.12.3
func (s *Specification) GetPDListWithManageHost() []string
GetPDListWithManageHost returns a list of PD API hosts of the current cluster
func (*Specification) GetTiKVLabels ¶ added in v1.2.3
func (s *Specification) GetTiKVLabels() (map[string]map[string]string, []map[string]api.LabelInfo, error)
GetTiKVLabels implements TiKVLabelProvider
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), concurrency ...int)
IterInstance iterates all instances in component starting order
func (*Specification) LocationLabels ¶ added in v1.2.0
func (s *Specification) LocationLabels() ([]string, error)
LocationLabels returns replication.location-labels in PD config
func (*Specification) Merge ¶
func (s *Specification) Merge(that Topology) Topology
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) TLSConfig ¶ added in v1.2.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 ¶
func (s *Specification) UnmarshalYAML(unmarshal func(any) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface, it sets the 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{ Topology *Specification }
TiDBComponent represents TiDB component.
func (*TiDBComponent) CalculateVersion ¶ added in v1.14.0
func (c *TiDBComponent) CalculateVersion(clusterVersion string) string
CalculateVersion implements the Component interface
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.
func (*TiDBComponent) SetVersion ¶ added in v1.14.0
func (c *TiDBComponent) SetVersion(version string)
SetVersion implements Component interface.
func (*TiDBComponent) Source ¶ added in v1.14.0
func (c *TiDBComponent) Source() string
Source implements Component interface.
type TiDBInstance ¶
type TiDBInstance struct { BaseInstance // contains filtered or unexported fields }
TiDBInstance represent the TiDB instance
type TiDBSpec ¶
type TiDBSpec struct { Host string `yaml:"host"` ManageHost string `yaml:"manage_host,omitempty" validate:"manage_host:editable"` ListenHost string `yaml:"listen_host,omitempty"` AdvertiseAddr string `yaml:"advertise_address,omitempty"` 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"` 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"` Source string `yaml:"source,omitempty" validate:"source:editable"` NumaNode string `yaml:"numa_node,omitempty" validate:"numa_node:editable"` NumaCores string `yaml:"numa_cores,omitempty" validate:"numa_cores:editable"` Config map[string]any `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) GetManageHost ¶ added in v1.12.3
GetManageHost returns the manage host of the instance
func (*TiDBSpec) IgnoreMonitorAgent ¶ added in v1.6.0
IgnoreMonitorAgent returns if the node does not have monitor agents available
func (*TiDBSpec) IsImported ¶
IsImported returns if the node is imported from TiDB-Ansible
type TiFlashComponent ¶
type TiFlashComponent struct{ Topology *Specification }
TiFlashComponent represents TiFlash component.
func (*TiFlashComponent) CalculateVersion ¶ added in v1.14.0
func (c *TiFlashComponent) CalculateVersion(clusterVersion string) string
CalculateVersion implements the Component interface
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.
func (*TiFlashComponent) SetVersion ¶ added in v1.14.0
func (c *TiFlashComponent) SetVersion(version string)
SetVersion implements Component interface.
func (*TiFlashComponent) Source ¶ added in v1.14.0
func (c *TiFlashComponent) Source() string
Source implements Component interface.
type TiFlashInstance ¶
type TiFlashInstance struct { BaseInstance // contains filtered or unexported fields }
TiFlashInstance represent the TiFlash instance
func (*TiFlashInstance) CheckIncorrectConfigs ¶ added in v1.2.5
func (i *TiFlashInstance) CheckIncorrectConfigs() error
CheckIncorrectConfigs checks incorrect settings
func (*TiFlashInstance) GetServicePort ¶
func (i *TiFlashInstance) GetServicePort() int
GetServicePort returns the service port of TiFlash
func (*TiFlashInstance) GetStatusPort ¶ added in v1.7.0
func (i *TiFlashInstance) GetStatusPort() int
GetStatusPort returns the status port of TiFlash
func (*TiFlashInstance) InitConfig ¶
func (i *TiFlashInstance) InitConfig( ctx context.Context, e ctxt.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths, ) error
InitConfig implement Instance interface
func (*TiFlashInstance) InitTiFlashLearnerConfig ¶
func (i *TiFlashInstance) InitTiFlashLearnerConfig(ctx context.Context, clusterVersion string, src map[string]any, paths meta.DirPaths) (map[string]any, error)
InitTiFlashLearnerConfig initializes TiFlash learner config file
func (*TiFlashInstance) PrepareStart ¶
PrepareStart checks TiFlash requirements before starting
type TiFlashSpec ¶
type TiFlashSpec 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"` TCPPort int `yaml:"tcp_port" default:"9000"` HTTPPort int `yaml:"http_port" default:"8123"` // Deprecated since v7.1.0 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" validate:"data_dir:expandable"` LogDir string `yaml:"log_dir,omitempty"` TmpDir string `yaml:"tmp_path,omitempty"` Offline bool `yaml:"offline,omitempty"` Source string `yaml:"source,omitempty" validate:"source:editable"` NumaNode string `yaml:"numa_node,omitempty" validate:"numa_node:editable"` NumaCores string `yaml:"numa_cores,omitempty" validate:"numa_cores:editable"` Config map[string]any `yaml:"config,omitempty" validate:"config:ignore"` LearnerConfig map[string]any `yaml:"learner_config,omitempty" validate:"learner_config:ignore"` 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) GetExtendedRole ¶ added in v1.12.0
func (s *TiFlashSpec) GetExtendedRole(ctx context.Context, tlsCfg *tls.Config, pdList ...string) string
GetExtendedRole get extended name for TiFlash to distinguish disaggregated mode.
func (*TiFlashSpec) GetMainPort ¶
func (s *TiFlashSpec) GetMainPort() int
GetMainPort returns the main port of the instance
func (*TiFlashSpec) GetManageHost ¶ added in v1.12.3
func (s *TiFlashSpec) GetManageHost() string
GetManageHost returns the manage host of the instance
func (*TiFlashSpec) GetOverrideDataDir ¶ added in v1.2.5
func (s *TiFlashSpec) GetOverrideDataDir() (string, error)
GetOverrideDataDir returns the data dir. If users have defined TiFlashStorageKeyMainDirs, then override "DataDir" with the directories defined in TiFlashStorageKeyMainDirs and TiFlashStorageKeyLatestDirs
func (*TiFlashSpec) IgnoreMonitorAgent ¶ added in v1.6.0
func (s *TiFlashSpec) IgnoreMonitorAgent() bool
IgnoreMonitorAgent returns if the node does not have monitor agents available
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
type TiKVCDCComponent ¶ added in v1.11.0
type TiKVCDCComponent struct{ Topology *Specification }
TiKVCDCComponent represents TiKV-CDC component.
func (*TiKVCDCComponent) CalculateVersion ¶ added in v1.14.0
func (c *TiKVCDCComponent) CalculateVersion(clusterVersion string) string
CalculateVersion implements the Component interface
func (*TiKVCDCComponent) Instances ¶ added in v1.11.0
func (c *TiKVCDCComponent) Instances() []Instance
Instances implements Component interface.
func (*TiKVCDCComponent) Name ¶ added in v1.11.0
func (c *TiKVCDCComponent) Name() string
Name implements Component interface.
func (*TiKVCDCComponent) Role ¶ added in v1.11.0
func (c *TiKVCDCComponent) Role() string
Role implements Component interface.
func (*TiKVCDCComponent) SetVersion ¶ added in v1.14.0
func (c *TiKVCDCComponent) SetVersion(version string)
SetVersion implements Component interface.
func (*TiKVCDCComponent) Source ¶ added in v1.14.0
func (c *TiKVCDCComponent) Source() string
Source implements Component interface.
type TiKVCDCInstance ¶ added in v1.11.0
type TiKVCDCInstance struct { BaseInstance // contains filtered or unexported fields }
TiKVCDCInstance represent the TiKV-CDC instance.
func (*TiKVCDCInstance) InitConfig ¶ added in v1.11.0
func (i *TiKVCDCInstance) InitConfig( ctx context.Context, e ctxt.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths, ) error
InitConfig implements Instance interface.
func (*TiKVCDCInstance) PostRestart ¶ added in v1.11.0
PostRestart implements RollingUpdateInstance interface.
func (*TiKVCDCInstance) PreRestart ¶ added in v1.11.0
func (i *TiKVCDCInstance) PreRestart(ctx context.Context, topo Topology, apiTimeoutSeconds int, tlsCfg *tls.Config) error
PreRestart implements RollingUpdateInstance interface. All errors are ignored, to trigger hard restart.
type TiKVCDCSpec ¶ added in v1.11.0
type TiKVCDCSpec 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"` Port int `yaml:"port" default:"8600"` DeployDir string `yaml:"deploy_dir,omitempty"` DataDir string `yaml:"data_dir,omitempty"` LogDir string `yaml:"log_dir,omitempty"` Offline bool `yaml:"offline,omitempty"` GCTTL int64 `yaml:"gc-ttl,omitempty" validate:"gc-ttl:editable"` TZ string `yaml:"tz,omitempty" validate:"tz:editable"` 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 meta.ResourceControl `yaml:"resource_control,omitempty" validate:"resource_control:editable"` Arch string `yaml:"arch,omitempty"` OS string `yaml:"os,omitempty"` }
TiKVCDCSpec represents the TiKVCDC topology specification in topology.yaml
func (*TiKVCDCSpec) GetMainPort ¶ added in v1.11.0
func (s *TiKVCDCSpec) GetMainPort() int
GetMainPort returns the main port of the instance
func (*TiKVCDCSpec) GetManageHost ¶ added in v1.12.3
func (s *TiKVCDCSpec) GetManageHost() string
GetManageHost returns the manage host of the instance
func (*TiKVCDCSpec) IgnoreMonitorAgent ¶ added in v1.11.0
func (s *TiKVCDCSpec) IgnoreMonitorAgent() bool
IgnoreMonitorAgent returns if the node does not have monitor agents available
func (*TiKVCDCSpec) IsImported ¶ added in v1.11.0
func (s *TiKVCDCSpec) IsImported() bool
IsImported returns if the node is imported from TiDB-Ansible
func (*TiKVCDCSpec) Role ¶ added in v1.11.0
func (s *TiKVCDCSpec) Role() string
Role returns the component role of the instance
func (*TiKVCDCSpec) SSH ¶ added in v1.11.0
func (s *TiKVCDCSpec) SSH() (string, int)
SSH returns the host and SSH port of the instance
type TiKVComponent ¶
type TiKVComponent struct{ Topology *Specification }
TiKVComponent represents TiKV component.
func (*TiKVComponent) CalculateVersion ¶ added in v1.14.0
func (c *TiKVComponent) CalculateVersion(clusterVersion string) string
CalculateVersion implements the Component interface
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.
func (*TiKVComponent) SetVersion ¶ added in v1.14.0
func (c *TiKVComponent) SetVersion(version string)
SetVersion implements Component interface.
func (*TiKVComponent) Source ¶ added in v1.14.0
func (c *TiKVComponent) Source() string
Source 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( ctx context.Context, e ctxt.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths, ) error
InitConfig implement Instance interface
func (*TiKVInstance) PostRestart ¶ added in v1.0.9
PostRestart implements RollingUpdateInstance interface.
func (*TiKVInstance) PreRestart ¶ added in v1.0.9
func (i *TiKVInstance) PreRestart(ctx context.Context, topo Topology, apiTimeoutSeconds int, tlsCfg *tls.Config) error
PreRestart implements RollingUpdateInstance interface.
type TiKVLabelError ¶ added in v1.2.0
TiKVLabelError indicates that some TiKV servers don't have correct labels
func (*TiKVLabelError) Error ¶ added in v1.2.0
func (e *TiKVLabelError) Error() string
Error implements error
type TiKVLabelProvider ¶ added in v1.2.3
type TiKVLabelProvider interface {
GetTiKVLabels() (map[string]map[string]string, []map[string]api.LabelInfo, error)
}
TiKVLabelProvider provides the store labels information
type TiKVSpec ¶
type TiKVSpec struct { Host string `yaml:"host"` ManageHost string `yaml:"manage_host,omitempty" validate:"manage_host:editable"` ListenHost string `yaml:"listen_host,omitempty"` AdvertiseAddr string `yaml:"advertise_addr,omitempty"` 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"` Port int `yaml:"port" default:"20160"` StatusPort int `yaml:"status_port" default:"20180"` AdvertiseStatusAddr string `yaml:"advertise_status_addr,omitempty"` DeployDir string `yaml:"deploy_dir,omitempty"` DataDir string `yaml:"data_dir,omitempty"` LogDir string `yaml:"log_dir,omitempty"` Offline bool `yaml:"offline,omitempty"` Source string `yaml:"source,omitempty" validate:"source:editable"` NumaNode string `yaml:"numa_node,omitempty" validate:"numa_node:editable"` NumaCores string `yaml:"numa_cores,omitempty" validate:"numa_cores:editable"` Config map[string]any `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) GetManageHost ¶ added in v1.12.3
GetManageHost returns the manage host of the instance
func (*TiKVSpec) IgnoreMonitorAgent ¶ added in v1.6.0
IgnoreMonitorAgent returns if the node does not have monitor agents available
func (*TiKVSpec) IsImported ¶
IsImported returns if the node is imported from TiDB-Ansible
type TiProxyComponent ¶ added in v1.14.0
type TiProxyComponent struct{ Topology *Specification }
TiProxyComponent represents TiProxy component.
func (*TiProxyComponent) CalculateVersion ¶ added in v1.14.0
func (c *TiProxyComponent) CalculateVersion(clusterVersion string) string
CalculateVersion implements the Component interface
func (*TiProxyComponent) Instances ¶ added in v1.14.0
func (c *TiProxyComponent) Instances() []Instance
Instances implements Component interface.
func (*TiProxyComponent) Name ¶ added in v1.14.0
func (c *TiProxyComponent) Name() string
Name implements Component interface.
func (*TiProxyComponent) Role ¶ added in v1.14.0
func (c *TiProxyComponent) Role() string
Role implements Component interface.
func (*TiProxyComponent) SetVersion ¶ added in v1.14.0
func (c *TiProxyComponent) SetVersion(version string)
SetVersion implements Component interface.
func (*TiProxyComponent) Source ¶ added in v1.14.0
func (c *TiProxyComponent) Source() string
Source implements Component interface.
type TiProxyInstance ¶ added in v1.14.0
type TiProxyInstance struct { BaseInstance // contains filtered or unexported fields }
TiProxyInstance represent the TiProxy instance.
func (*TiProxyInstance) GetAddr ¶ added in v1.14.0
func (i *TiProxyInstance) GetAddr() string
GetAddr return the address of this TiProxy instance
func (*TiProxyInstance) InitConfig ¶ added in v1.14.0
func (i *TiProxyInstance) InitConfig( ctx context.Context, e ctxt.Executor, clusterName, clusterVersion, deployUser string, paths meta.DirPaths, ) error
InitConfig implements Instance interface.
func (*TiProxyInstance) PostRestart ¶ added in v1.14.0
PostRestart implements RollingUpdateInstance interface.
func (*TiProxyInstance) PreRestart ¶ added in v1.14.0
func (i *TiProxyInstance) PreRestart(ctx context.Context, topo Topology, apiTimeoutSeconds int, tlsCfg *tls.Config) error
PreRestart implements RollingUpdateInstance interface.
type TiProxySpec ¶ added in v1.14.0
type TiProxySpec 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"` Port int `yaml:"port" default:"6000"` StatusPort int `yaml:"status_port" default:"3080"` DeployDir string `yaml:"deploy_dir,omitempty"` NumaNode string `yaml:"numa_node,omitempty" validate:"numa_node:editable"` Config map[string]any `yaml:"config,omitempty" validate:"config:ignore"` Arch string `yaml:"arch,omitempty"` OS string `yaml:"os,omitempty"` }
TiProxySpec represents the TiProxy topology specification in topology.yaml
func (*TiProxySpec) GetMainPort ¶ added in v1.14.0
func (s *TiProxySpec) GetMainPort() int
GetMainPort returns the main port of the instance
func (*TiProxySpec) GetManageHost ¶ added in v1.14.0
func (s *TiProxySpec) GetManageHost() string
GetManageHost returns the manage host of the instance
func (*TiProxySpec) IgnoreMonitorAgent ¶ added in v1.14.0
func (s *TiProxySpec) IgnoreMonitorAgent() bool
IgnoreMonitorAgent returns if the node does not have monitor agents available
func (*TiProxySpec) IsImported ¶ added in v1.14.0
func (s *TiProxySpec) IsImported() bool
IsImported returns if the node is imported from TiDB-Ansible
func (*TiProxySpec) Role ¶ added in v1.14.0
func (s *TiProxySpec) Role() string
Role returns the component role of the instance
func (*TiProxySpec) SSH ¶ added in v1.14.0
func (s *TiProxySpec) SSH() (string, int)
SSH returns the host and SSH port of the instance
type TiSparkMasterComponent ¶ added in v1.0.9
type TiSparkMasterComponent struct{ Topology *Specification }
TiSparkMasterComponent represents TiSpark master component.
func (*TiSparkMasterComponent) CalculateVersion ¶ added in v1.14.0
func (c *TiSparkMasterComponent) CalculateVersion(clusterVersion string) string
CalculateVersion implements the Component interface
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.
func (*TiSparkMasterComponent) SetVersion ¶ added in v1.14.0
func (c *TiSparkMasterComponent) SetVersion(version string)
SetVersion implements Component interface.
func (*TiSparkMasterComponent) Source ¶ added in v1.14.0
func (c *TiSparkMasterComponent) Source() string
Source 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]any
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
type TiSparkMasterSpec ¶ added in v1.0.9
type TiSparkMasterSpec struct { Host string `yaml:"host"` ManageHost string `yaml:"manage_host,omitempty" validate:"manage_host:editable"` ListenHost string `yaml:"listen_host,omitempty"` 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"` 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]any `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) IgnoreMonitorAgent ¶ added in v1.6.0
func (s *TiSparkMasterSpec) IgnoreMonitorAgent() bool
IgnoreMonitorAgent returns if the node does not have monitor agents available
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
type TiSparkWorkerComponent ¶ added in v1.0.9
type TiSparkWorkerComponent struct{ Topology *Specification }
TiSparkWorkerComponent represents TiSpark slave component.
func (*TiSparkWorkerComponent) CalculateVersion ¶ added in v1.14.0
func (c *TiSparkWorkerComponent) CalculateVersion(clusterVersion string) string
CalculateVersion implements the Component interface
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.
func (*TiSparkWorkerComponent) SetVersion ¶ added in v1.14.0
func (c *TiSparkWorkerComponent) SetVersion(version string)
SetVersion implements Component interface.
func (*TiSparkWorkerComponent) Source ¶ added in v1.14.0
func (c *TiSparkWorkerComponent) Source() string
Source 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
type TiSparkWorkerSpec ¶ added in v1.0.9
type TiSparkWorkerSpec struct { Host string `yaml:"host"` ManageHost string `yaml:"manage_host,omitempty"` ListenHost string `yaml:"listen_host,omitempty"` 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"` 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) IgnoreMonitorAgent ¶ added in v1.6.0
func (s *TiSparkWorkerSpec) IgnoreMonitorAgent() bool
IgnoreMonitorAgent returns if the node does not have monitor agents available
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
type Topology ¶ added in v1.0.9
type Topology interface { Type() string 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(curVer string) []Component IterInstance(fn func(instance Instance), concurrency ...int) GetMonitoredOptions() *MonitoredOptions // count how many time a path is used by instances in cluster CountDir(host string, dir string) int TLSConfig(dir string) (*tls.Config, error) Merge(that Topology) Topology FillHostArchOrOS(hostArchmap map[string]string, fullType FullHostType) error GetGrafanaConfig() map[string]string ScaleOutTopology }
Topology represents specification of the cluster.
type UpgradableMetadata ¶ added in v1.0.9
UpgradableMetadata represents a upgradable Metadata.