Documentation
¶
Index ¶
- Constants
- type AttributeMap
- type Component
- type ComponentSpec
- type ComponentType
- type DMMasterSpec
- func (s *DMMasterSpec) Attributes() AttributeMap
- func (s *DMMasterSpec) ConfigURL() string
- func (s *DMMasterSpec) Domain() string
- func (s *DMMasterSpec) Host() string
- func (s *DMMasterSpec) ID() string
- func (s *DMMasterSpec) MainPort() int
- func (s *DMMasterSpec) SSHPort() int
- func (s *DMMasterSpec) StatusPort() int
- func (s *DMMasterSpec) StatusURL() string
- func (s *DMMasterSpec) Type() ComponentType
- type DMWorkerSpec
- func (s *DMWorkerSpec) Attributes() AttributeMap
- func (s *DMWorkerSpec) ConfigURL() string
- func (s *DMWorkerSpec) Domain() string
- func (s *DMWorkerSpec) Host() string
- func (s *DMWorkerSpec) ID() string
- func (s *DMWorkerSpec) MainPort() int
- func (s *DMWorkerSpec) SSHPort() int
- func (s *DMWorkerSpec) StatusPort() int
- func (s *DMWorkerSpec) StatusURL() string
- func (s *DMWorkerSpec) Type() ComponentType
- type DrainerSpec
- func (s *DrainerSpec) Attributes() AttributeMap
- func (s *DrainerSpec) ConfigURL() string
- func (s *DrainerSpec) Domain() string
- func (s *DrainerSpec) Host() string
- func (s *DrainerSpec) ID() string
- func (s *DrainerSpec) MainPort() int
- func (s *DrainerSpec) SSHPort() int
- func (s *DrainerSpec) StatusPort() int
- func (s *DrainerSpec) StatusURL() string
- func (s *DrainerSpec) Type() ComponentType
- type MonitorSpec
- func (s *MonitorSpec) Attributes() AttributeMap
- func (s *MonitorSpec) ConfigURL() string
- func (s *MonitorSpec) Domain() string
- func (s *MonitorSpec) Host() string
- func (s *MonitorSpec) ID() string
- func (s *MonitorSpec) MainPort() int
- func (s *MonitorSpec) SSHPort() int
- func (s *MonitorSpec) StatusPort() int
- func (s *MonitorSpec) StatusURL() string
- func (s *MonitorSpec) Type() ComponentType
- type PDSpec
- func (s *PDSpec) Attributes() AttributeMap
- func (s *PDSpec) ConfigURL() string
- func (s *PDSpec) Domain() string
- func (s *PDSpec) Host() string
- func (s *PDSpec) ID() string
- func (s *PDSpec) MainPort() int
- func (s *PDSpec) SSHPort() int
- func (s *PDSpec) StatusPort() int
- func (s *PDSpec) StatusURL() string
- func (s *PDSpec) Type() ComponentType
- type PumpSpec
- func (s *PumpSpec) Attributes() AttributeMap
- func (s *PumpSpec) ConfigURL() string
- func (s *PumpSpec) Domain() string
- func (s *PumpSpec) Host() string
- func (s *PumpSpec) ID() string
- func (s *PumpSpec) MainPort() int
- func (s *PumpSpec) SSHPort() int
- func (s *PumpSpec) StatusPort() int
- func (s *PumpSpec) StatusURL() string
- func (s *PumpSpec) Type() ComponentType
- type TiCDCSpec
- func (s *TiCDCSpec) Attributes() AttributeMap
- func (s *TiCDCSpec) ConfigURL() string
- func (s *TiCDCSpec) Domain() string
- func (s *TiCDCSpec) Host() string
- func (s *TiCDCSpec) ID() string
- func (s *TiCDCSpec) MainPort() int
- func (s *TiCDCSpec) SSHPort() int
- func (s *TiCDCSpec) StatusPort() int
- func (s *TiCDCSpec) StatusURL() string
- func (s *TiCDCSpec) Type() ComponentType
- type TiDBCluster
- type TiDBSpec
- func (s *TiDBSpec) Attributes() AttributeMap
- func (s *TiDBSpec) ConfigURL() string
- func (s *TiDBSpec) Domain() string
- func (s *TiDBSpec) Host() string
- func (s *TiDBSpec) ID() string
- func (s *TiDBSpec) MainPort() int
- func (s *TiDBSpec) SSHPort() int
- func (s *TiDBSpec) StatusPort() int
- func (s *TiDBSpec) StatusURL() string
- func (s *TiDBSpec) Type() ComponentType
- type TiFlashSpec
- func (s *TiFlashSpec) Attributes() AttributeMap
- func (s *TiFlashSpec) ConfigURL() string
- func (s *TiFlashSpec) Domain() string
- func (s *TiFlashSpec) Host() string
- func (s *TiFlashSpec) ID() string
- func (s *TiFlashSpec) MainPort() int
- func (s *TiFlashSpec) SSHPort() int
- func (s *TiFlashSpec) StatusPort() int
- func (s *TiFlashSpec) StatusURL() string
- func (s *TiFlashSpec) Type() ComponentType
- type TiKVSpec
- func (s *TiKVSpec) Attributes() AttributeMap
- func (s *TiKVSpec) ConfigURL() string
- func (s *TiKVSpec) Domain() string
- func (s *TiKVSpec) Host() string
- func (s *TiKVSpec) ID() string
- func (s *TiKVSpec) MainPort() int
- func (s *TiKVSpec) SSHPort() int
- func (s *TiKVSpec) StatusPort() int
- func (s *TiKVSpec) StatusURL() string
- func (s *TiKVSpec) Type() ComponentType
- type TiSparkCSpec
- func (s *TiSparkCSpec) Attributes() AttributeMap
- func (s *TiSparkCSpec) ConfigURL() string
- func (s *TiSparkCSpec) Domain() string
- func (s *TiSparkCSpec) Host() string
- func (s *TiSparkCSpec) ID() string
- func (s *TiSparkCSpec) IsMaster() bool
- func (s *TiSparkCSpec) MainPort() int
- func (s *TiSparkCSpec) SSHPort() int
- func (s *TiSparkCSpec) StatusPort() int
- func (s *TiSparkCSpec) StatusURL() string
- func (s *TiSparkCSpec) Type() ComponentType
Constants ¶
const ( AttrKeyConfigFileList = "config_files" AttrKeyLogFileList = "log_files" AttrKeyMetricsDir = "metrics_dir" )
Some predefined key names for extended metadata
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttributeMap ¶
type AttributeMap map[string]interface{}
AttributeMap are extended key-values related to an object
func (AttributeMap) AddConfigFile ¶
func (attr AttributeMap) AddConfigFile(p string)
AddConfigFile inserts path of a config file to the list
func (AttributeMap) AddLogFile ¶
func (attr AttributeMap) AddLogFile(p string)
AddLogFile inserts path of a log file to the list
func (AttributeMap) SetMetricsDir ¶
func (attr AttributeMap) SetMetricsDir(p string)
SetMetricsDir sets the path of metrics files
type Component ¶
type Component interface { Type() ComponentType Host() string MainPort() int StatusPort() int SSHPort() int // empty for tidb-operator ID() string // host:port identifier StatusURL() string // the url to request for compoent status, without http/https scheme ConfigURL() string // the url to request for realtime configs, without http/https scheme Attributes() AttributeMap }
Component is the interface for any component
func FilterComponent ¶
FilterComponent filter components by set
type ComponentSpec ¶
type ComponentSpec struct { Host string `json:"host"` Port int `json:"port"` StatusPort int `json:"status_port"` SSHPort int `json:"ssh_port,omitempty"` Attributes AttributeMap `json:"attributes,omitempty"` }
ComponentSpec is the definition of general component
type ComponentType ¶
type ComponentType string
ComponentType are types of a component
const ( ComponentTypePD ComponentType = "pd" ComponentTypeTiKV ComponentType = "tikv" ComponentTypeTiDB ComponentType = "tidb" ComponentTypeTiFlash ComponentType = "tiflash" ComponentTypePump ComponentType = "pump" ComponentTypeDrainer ComponentType = "drainer" ComponentTypeTiCDC ComponentType = "ticdc" ComponentTypeTiSpark ComponentType = "tispark" ComponentTypeMonitor ComponentType = "prometheus" // prometheus and/or ng-monitor ComponentTypeDMMaster ComponentType = "dm-master" ComponentTypeDMWorker ComponentType = "dm-worker" )
types for components
type DMMasterSpec ¶
type DMMasterSpec struct {
ComponentSpec `json:",inline"`
}
DMMaterSpec represent PD nodes
func (*DMMasterSpec) Attributes ¶
func (s *DMMasterSpec) Attributes() AttributeMap
Attributes implements Component interface
func (*DMMasterSpec) ConfigURL ¶
func (s *DMMasterSpec) ConfigURL() string
ConfigURL implements Component interface
func (*DMMasterSpec) Domain ¶
func (s *DMMasterSpec) Domain() string
Domain implements Component interface
func (*DMMasterSpec) Host ¶
func (s *DMMasterSpec) Host() string
Host implements Component interface
func (*DMMasterSpec) MainPort ¶
func (s *DMMasterSpec) MainPort() int
MainPort implements Component interface
func (*DMMasterSpec) SSHPort ¶
func (s *DMMasterSpec) SSHPort() int
SSHPort implements Component interface
func (*DMMasterSpec) StatusPort ¶
func (s *DMMasterSpec) StatusPort() int
StatusPort implements Component interface
func (*DMMasterSpec) StatusURL ¶
func (s *DMMasterSpec) StatusURL() string
StatusURL implements Component interface
func (*DMMasterSpec) Type ¶
func (s *DMMasterSpec) Type() ComponentType
Type implements Component interface
type DMWorkerSpec ¶
type DMWorkerSpec struct {
ComponentSpec `json:",inline"`
}
DMWorkerSpec represent PD nodes
func (*DMWorkerSpec) Attributes ¶
func (s *DMWorkerSpec) Attributes() AttributeMap
Attributes implements Component interface
func (*DMWorkerSpec) ConfigURL ¶
func (s *DMWorkerSpec) ConfigURL() string
ConfigURL implements Component interface
func (*DMWorkerSpec) Domain ¶
func (s *DMWorkerSpec) Domain() string
Domain implements Component interface
func (*DMWorkerSpec) Host ¶
func (s *DMWorkerSpec) Host() string
Host implements Component interface
func (*DMWorkerSpec) MainPort ¶
func (s *DMWorkerSpec) MainPort() int
MainPort implements Component interface
func (*DMWorkerSpec) SSHPort ¶
func (s *DMWorkerSpec) SSHPort() int
SSHPort implements Component interface
func (*DMWorkerSpec) StatusPort ¶
func (s *DMWorkerSpec) StatusPort() int
StatusPort implements Component interface
func (*DMWorkerSpec) StatusURL ¶
func (s *DMWorkerSpec) StatusURL() string
StatusURL implements Component interface
func (*DMWorkerSpec) Type ¶
func (s *DMWorkerSpec) Type() ComponentType
Type implements Component interface
type DrainerSpec ¶
type DrainerSpec struct {
ComponentSpec `json:",inline"`
}
DrainerSpec represent PD nodes
func (*DrainerSpec) Attributes ¶
func (s *DrainerSpec) Attributes() AttributeMap
Attributes implements Component interface
func (*DrainerSpec) ConfigURL ¶
func (s *DrainerSpec) ConfigURL() string
ConfigURL implements Component interface
func (*DrainerSpec) Domain ¶
func (s *DrainerSpec) Domain() string
Domain implements Component interface
func (*DrainerSpec) MainPort ¶
func (s *DrainerSpec) MainPort() int
MainPort implements Component interface
func (*DrainerSpec) SSHPort ¶
func (s *DrainerSpec) SSHPort() int
SSHPort implements Component interface
func (*DrainerSpec) StatusPort ¶
func (s *DrainerSpec) StatusPort() int
StatusPort implements Component interface
func (*DrainerSpec) StatusURL ¶
func (s *DrainerSpec) StatusURL() string
StatusURL implements Component interface
func (*DrainerSpec) Type ¶
func (s *DrainerSpec) Type() ComponentType
Type implements Component interface
type MonitorSpec ¶
type MonitorSpec struct { ComponentSpec `json:",inline"` Endpoint string `json:"endpoint,omitempty"` // the metric endpoint, normally prometheus address NGEndpoint string `json:"ng_endpoint,omitempty"` // the endpoint of NG-monitor, might be empty }
MonitorSpec is the spec needed for monitoring nodes
func (*MonitorSpec) Attributes ¶
func (s *MonitorSpec) Attributes() AttributeMap
Attributes implements Component interface
func (*MonitorSpec) ConfigURL ¶
func (s *MonitorSpec) ConfigURL() string
ConfigURL implements Component interface
func (*MonitorSpec) Domain ¶
func (s *MonitorSpec) Domain() string
Domain implements Component interface
func (*MonitorSpec) MainPort ¶
func (s *MonitorSpec) MainPort() int
MainPort implements Component interface
func (*MonitorSpec) SSHPort ¶
func (s *MonitorSpec) SSHPort() int
SSHPort implements Component interface
func (*MonitorSpec) StatusPort ¶
func (s *MonitorSpec) StatusPort() int
StatusPort implements Component interface
func (*MonitorSpec) StatusURL ¶
func (s *MonitorSpec) StatusURL() string
StatusURL implements Component interface
func (*MonitorSpec) Type ¶
func (s *MonitorSpec) Type() ComponentType
Type implements Component interface
type PDSpec ¶
type PDSpec struct {
ComponentSpec `json:",inline"`
}
PDSpec represent PD nodes
func (*PDSpec) Attributes ¶
func (s *PDSpec) Attributes() AttributeMap
Attributes implements Component interface
func (*PDSpec) StatusPort ¶
StatusPort implements Component interface
type PumpSpec ¶
type PumpSpec struct {
ComponentSpec `json:",inline"`
}
PumpSpec represent PD nodes
func (*PumpSpec) Attributes ¶
func (s *PumpSpec) Attributes() AttributeMap
Attributes implements Component interface
func (*PumpSpec) StatusPort ¶
StatusPort implements Component interface
type TiCDCSpec ¶
type TiCDCSpec struct {
ComponentSpec `json:",inline"`
}
TiCDCSpec represent PD nodes
func (*TiCDCSpec) Attributes ¶
func (s *TiCDCSpec) Attributes() AttributeMap
Attributes implements Component interface
func (*TiCDCSpec) StatusPort ¶
StatusPort implements Component interface
func (*TiCDCSpec) Type ¶
func (s *TiCDCSpec) Type() ComponentType
Type implements Component interface
type TiDBCluster ¶
type TiDBCluster struct { Version string `json:"version"` // cluster version Namespace string `json:"namespace,omitempty"` Attributes AttributeMap `json:"attributes,omitempty"` PD []*PDSpec `json:"pd,omitempty"` // PD not exist on DM cluster TiKV []*TiKVSpec `json:"tikv,omitempty"` TiDB []*TiDBSpec `json:"tidb,omitempty"` TiFlash []*TiFlashSpec `json:"tiflash,omitempty"` TiCDC []*TiCDCSpec `json:"ticdc,omitempty"` Pump []*PumpSpec `json:"pump,omitempty"` Drainer []*DrainerSpec `json:"drainer,omitempty"` TiSpark []*TiSparkCSpec `json:"tispark,omitempty"` DMMaster []*DMMasterSpec `json:"dm-master,omitempty"` DMWorker []*DMWorkerSpec `json:"dm-worker,omitempty"` Monitors []*MonitorSpec `json:"monitors,omitempty"` // prometheus nodes }
TiDBCluster is the abstract topology of a TiDB cluster
func (*TiDBCluster) Components ¶
func (c *TiDBCluster) Components() (comps []Component)
Components list all available components in the cluster
func (*TiDBCluster) GetAllCDCInfo ¶
func (c *TiDBCluster) GetAllCDCInfo(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config) ([]*mvccpb.KeyValue, error)
getAllCDCInfo get all keys created by CDC
func (*TiDBCluster) GetEtcdClient ¶
GetEtcdClient loads EtcdClient of current cluster
type TiDBSpec ¶
type TiDBSpec struct {
ComponentSpec `json:",inline"`
}
TiDBSpec represent PD nodes
func (*TiDBSpec) Attributes ¶
func (s *TiDBSpec) Attributes() AttributeMap
Attributes implements Component interface
func (*TiDBSpec) StatusPort ¶
StatusPort implements Component interface
type TiFlashSpec ¶
type TiFlashSpec struct {
ComponentSpec `json:",inline"`
}
TiFlashSpec represent PD nodes
func (*TiFlashSpec) Attributes ¶
func (s *TiFlashSpec) Attributes() AttributeMap
Attributes implements Component interface
func (*TiFlashSpec) ConfigURL ¶
func (s *TiFlashSpec) ConfigURL() string
ConfigURL implements Component interface
func (*TiFlashSpec) Domain ¶
func (s *TiFlashSpec) Domain() string
Domain implements Component interface
func (*TiFlashSpec) MainPort ¶
func (s *TiFlashSpec) MainPort() int
MainPort implements Component interface
func (*TiFlashSpec) SSHPort ¶
func (s *TiFlashSpec) SSHPort() int
SSHPort implements Component interface
func (*TiFlashSpec) StatusPort ¶
func (s *TiFlashSpec) StatusPort() int
StatusPort implements Component interface
func (*TiFlashSpec) StatusURL ¶
func (s *TiFlashSpec) StatusURL() string
StatusURL implements Component interface
func (*TiFlashSpec) Type ¶
func (s *TiFlashSpec) Type() ComponentType
Type implements Component interface
type TiKVSpec ¶
type TiKVSpec struct {
ComponentSpec `json:",inline"`
}
TiKVSpec represent PD nodes
func (*TiKVSpec) Attributes ¶
func (s *TiKVSpec) Attributes() AttributeMap
Attributes implements Component interface
func (*TiKVSpec) StatusPort ¶
StatusPort implements Component interface
type TiSparkCSpec ¶
type TiSparkCSpec struct { ComponentSpec `json:",inline"` Master bool `json:"master"` }
TiSparkCSpec represent PD nodes
func (*TiSparkCSpec) Attributes ¶
func (s *TiSparkCSpec) Attributes() AttributeMap
Attributes implements Component interface
func (*TiSparkCSpec) ConfigURL ¶
func (s *TiSparkCSpec) ConfigURL() string
ConfigURL implements Component interface
func (*TiSparkCSpec) Domain ¶
func (s *TiSparkCSpec) Domain() string
Domain implements Component interface
func (*TiSparkCSpec) Host ¶
func (s *TiSparkCSpec) Host() string
Host implements Component interface
func (*TiSparkCSpec) IsMaster ¶
func (s *TiSparkCSpec) IsMaster() bool
IsMster checks if the node is a TiSpark master
func (*TiSparkCSpec) MainPort ¶
func (s *TiSparkCSpec) MainPort() int
MainPort implements Component interface
func (*TiSparkCSpec) SSHPort ¶
func (s *TiSparkCSpec) SSHPort() int
SSHPort implements Component interface
func (*TiSparkCSpec) StatusPort ¶
func (s *TiSparkCSpec) StatusPort() int
StatusPort implements Component interface
func (*TiSparkCSpec) StatusURL ¶
func (s *TiSparkCSpec) StatusURL() string
StatusURL implements Component interface
func (*TiSparkCSpec) Type ¶
func (s *TiSparkCSpec) Type() ComponentType
Type implements Component interface