Documentation
¶
Index ¶
- Variables
- func AsyncNodes(spec *meta.ClusterSpecification, nodes []string, async bool) []string
- func DeleteGlobalDirs(getter ExecutorGetter, host string, options meta.GlobalOptions) error
- func Destroy(getter ExecutorGetter, spec meta.Specification, options Options) error
- func DestroyClusterTombstone(getter ExecutorGetter, spec *meta.ClusterSpecification, returNodesOnly bool, ...) (nodes []string, err error)
- func DestroyComponent(getter ExecutorGetter, instances []meta.Instance, timeout int64) error
- func DestroyMonitored(getter ExecutorGetter, inst meta.Instance, options meta.MonitoredOptions, ...) error
- func DestroyTombstone(getter ExecutorGetter, spec meta.Specification, returNodesOnly bool, ...) (nodes []string, err error)
- func Download(component, nodeOS, arch string, version string) error
- func FilterComponent(comps []meta.Component, components set.StringSet) (res []meta.Component)
- func FilterInstance(instances []meta.Instance, nodes set.StringSet) (res []meta.Instance)
- func GetNodeInfo(ctx context.Context, getter ExecutorGetter, topo *meta.TopologySpecification) (nodes []*telemetry.NodeInfo, err error)
- func GetServiceStatus(e executor.TiOpsExecutor, name string) (active string, err error)
- func NeedCheckTomebsome(spec *meta.ClusterSpecification) bool
- func PrintClusterStatus(getter ExecutorGetter, spec meta.Specification) (health bool)
- func Restart(getter ExecutorGetter, spec meta.Specification, options Options) error
- func RestartComponent(getter ExecutorGetter, instances []meta.Instance, timeout int64) error
- func ScaleIn(getter ExecutorGetter, spec meta.Specification, options Options) error
- func ScaleInCluster(getter ExecutorGetter, spec *meta.ClusterSpecification, options Options) error
- func Start(getter ExecutorGetter, spec meta.Specification, options Options) error
- func StartComponent(getter ExecutorGetter, instances []meta.Instance, options Options) error
- func StartMonitored(getter ExecutorGetter, instance meta.Instance, options meta.MonitoredOptions, ...) error
- func Stop(getter ExecutorGetter, spec meta.Specification, options Options) error
- func StopComponent(getter ExecutorGetter, instances []meta.Instance) error
- func StopMonitored(getter ExecutorGetter, instance meta.Instance, options meta.MonitoredOptions, ...) error
- func Upgrade(getter ExecutorGetter, spec meta.Specification, options Options) error
- type CheckOptions
- type CheckResult
- func CheckFIOResult(rr, rw, lat []byte) []*CheckResult
- func CheckKernelParameters(opt *CheckOptions, p []byte) []*CheckResult
- func CheckListeningPort(opt *CheckOptions, host string, topo *meta.TopologySpecification, ...) []*CheckResult
- func CheckPartitions(opt *CheckOptions, host string, topo *meta.TopologySpecification, ...) []*CheckResult
- func CheckSELinux(e executor.TiOpsExecutor) *CheckResult
- func CheckServices(e executor.TiOpsExecutor, host, service string, disable bool) *CheckResult
- func CheckSysLimits(opt *CheckOptions, user string, l []byte) []*CheckResult
- func CheckSystemInfo(opt *CheckOptions, rawData []byte) []*CheckResult
- type ExecutorGetter
- type Operation
- type Options
Constants ¶
This section is empty.
Variables ¶
var ( CheckNameGeneral = "general" // errors that don't fit any specific check CheckNameNTP = "ntp" CheckNameOSVer = "os-version" CheckNameSwap = "swap" CheckNameSysctl = "sysctl" CheckNameCPUThreads = "cpu-cores" CheckNameCPUGovernor = "cpu-governor" CheckNameDisks = "disk" CheckNamePortListen = "listening-port" CheckNameEpoll = "epoll-exclusive" CheckNameMem = "memory" CheckNameLimits = "limits" CheckNameSysService = "service" CheckNameSELinux = "selinux" CheckNameCommand = "command" CheckNameFio = "fio" )
Names of checks
Functions ¶
func AsyncNodes ¶
func AsyncNodes(spec *meta.ClusterSpecification, nodes []string, async bool) []string
AsyncNodes return all nodes async destroy or not.
func DeleteGlobalDirs ¶
func DeleteGlobalDirs(getter ExecutorGetter, host string, options meta.GlobalOptions) error
DeleteGlobalDirs deletes all global directory if them empty
func Destroy ¶
func Destroy( getter ExecutorGetter, spec meta.Specification, options Options, ) error
Destroy the cluster.
func DestroyClusterTombstone ¶ added in v0.5.0
func DestroyClusterTombstone( getter ExecutorGetter, spec *meta.ClusterSpecification, returNodesOnly bool, options Options, ) (nodes []string, err error)
DestroyClusterTombstone remove the tombstone node in spec and destroy them. If returNodesOnly is true, it will only return the node id that can be destroy.
func DestroyComponent ¶
func DestroyComponent(getter ExecutorGetter, instances []meta.Instance, timeout int64) error
DestroyComponent destroy the instances.
func DestroyMonitored ¶
func DestroyMonitored(getter ExecutorGetter, inst meta.Instance, options meta.MonitoredOptions, timeout int64) error
DestroyMonitored destroy the monitored service.
func DestroyTombstone ¶
func DestroyTombstone( getter ExecutorGetter, spec meta.Specification, returNodesOnly bool, options Options, ) (nodes []string, err error)
DestroyTombstone remove the tombstone node in spec and destroy them. If returNodesOnly is true, it will only return the node id that can be destroy.
func Download ¶ added in v0.6.3
Download the specific version of a component from the repository, there is nothing to do if the specified version exists.
func FilterComponent ¶ added in v0.4.9
FilterComponent filter components by set
func FilterInstance ¶ added in v0.4.9
FilterInstance filter instances by set
func GetNodeInfo ¶ added in v0.6.3
func GetNodeInfo( ctx context.Context, getter ExecutorGetter, topo *meta.TopologySpecification, ) (nodes []*telemetry.NodeInfo, err error)
GetNodeInfo the node info in topology.
func GetServiceStatus ¶
func GetServiceStatus(e executor.TiOpsExecutor, name string) (active string, err error)
GetServiceStatus return the Acitive line of status.
[tidb@ip-172-16-5-70 deploy]$ sudo systemctl status drainer-8249.service ● drainer-8249.service - drainer-8249 service
Loaded: loaded (/etc/systemd/system/drainer-8249.service; disabled; vendor preset: disabled) Active: active (running) since Mon 2020-03-09 13:56:19 CST; 1 weeks 3 days ago Main PID: 36718 (drainer) CGroup: /system.slice/drainer-8249.service └─36718 bin/drainer --addr=172.16.5.70:8249 --pd-urls=http://172.16.5.70:2379 --data-dir=/data1/deploy/data.drainer --log-file=/data1/deploy/log/drainer.log --config=conf/drainer.toml --initial-commit-ts=408375872006389761
Mar 09 13:56:19 ip-172-16-5-70 systemd[1]: Started drainer-8249 service.
func NeedCheckTomebsome ¶
func NeedCheckTomebsome(spec *meta.ClusterSpecification) bool
NeedCheckTomebsome return true if we need to check and destroy some node.
func PrintClusterStatus ¶
func PrintClusterStatus(getter ExecutorGetter, spec meta.Specification) (health bool)
PrintClusterStatus print cluster status into the io.Writer.
func Restart ¶
func Restart( getter ExecutorGetter, spec meta.Specification, options Options, ) error
Restart the cluster.
func RestartComponent ¶
func RestartComponent(getter ExecutorGetter, instances []meta.Instance, timeout int64) error
RestartComponent restarts the component.
func ScaleIn ¶
func ScaleIn( getter ExecutorGetter, spec meta.Specification, options Options, ) error
ScaleIn scales in the cluster
func ScaleInCluster ¶ added in v0.5.0
func ScaleInCluster( getter ExecutorGetter, spec *meta.ClusterSpecification, options Options, ) error
ScaleInCluster scales in the cluster
func Start ¶
func Start( getter ExecutorGetter, spec meta.Specification, options Options, ) error
Start the cluster.
func StartComponent ¶
func StartComponent(getter ExecutorGetter, instances []meta.Instance, options Options) error
StartComponent start the instances.
func StartMonitored ¶
func StartMonitored(getter ExecutorGetter, instance meta.Instance, options meta.MonitoredOptions, timeout int64) error
StartMonitored start BlackboxExporter and NodeExporter
func Stop ¶
func Stop( getter ExecutorGetter, spec meta.Specification, options Options, ) error
Stop the cluster.
func StopComponent ¶
func StopComponent(getter ExecutorGetter, instances []meta.Instance) error
StopComponent stop the instances.
func StopMonitored ¶
func StopMonitored(getter ExecutorGetter, instance meta.Instance, options meta.MonitoredOptions, timeout int64) error
StopMonitored stop BlackboxExporter and NodeExporter
func Upgrade ¶
func Upgrade( getter ExecutorGetter, spec meta.Specification, options Options, ) error
Upgrade the cluster.
Types ¶
type CheckOptions ¶ added in v0.5.0
type CheckOptions struct { // checks that are disabled by default EnableCPU bool EnableMem bool EnableDisk bool }
CheckOptions control the list of checks to be performed
type CheckResult ¶ added in v0.5.0
type CheckResult struct { Name string // Name of the check Err error // An embedded error Warn bool // The check didn't pass, but not a big problem Msg string // A message or description }
CheckResult is the result of a check
func CheckFIOResult ¶ added in v0.5.0
func CheckFIOResult(rr, rw, lat []byte) []*CheckResult
CheckFIOResult parses and checks the result of fio test
func CheckKernelParameters ¶ added in v0.5.0
func CheckKernelParameters(opt *CheckOptions, p []byte) []*CheckResult
CheckKernelParameters checks kernel parameter values
func CheckListeningPort ¶ added in v0.5.0
func CheckListeningPort(opt *CheckOptions, host string, topo *meta.TopologySpecification, rawData []byte) []*CheckResult
CheckListeningPort checks if the ports are already binded by some process on host
func CheckPartitions ¶ added in v0.5.0
func CheckPartitions(opt *CheckOptions, host string, topo *meta.TopologySpecification, rawData []byte) []*CheckResult
CheckPartitions checks partition info of data directories
func CheckSELinux ¶ added in v0.5.0
func CheckSELinux(e executor.TiOpsExecutor) *CheckResult
CheckSELinux checks if SELinux is enabled on the host
func CheckServices ¶ added in v0.5.0
func CheckServices(e executor.TiOpsExecutor, host, service string, disable bool) *CheckResult
CheckServices checks if a service is running on the host
func CheckSysLimits ¶ added in v0.5.0
func CheckSysLimits(opt *CheckOptions, user string, l []byte) []*CheckResult
CheckSysLimits checks limits in /etc/security/limits.conf
func CheckSystemInfo ¶ added in v0.5.0
func CheckSystemInfo(opt *CheckOptions, rawData []byte) []*CheckResult
CheckSystemInfo performs checks with basic system info
func (CheckResult) Error ¶ added in v0.5.0
func (c CheckResult) Error() string
Error implements the error interface
func (CheckResult) IsWarning ¶ added in v0.5.0
func (c CheckResult) IsWarning() bool
IsWarning checks if the result is a warning error
func (CheckResult) Passed ¶ added in v0.5.0
func (c CheckResult) Passed() bool
Passed checks if the result is a success
func (CheckResult) String ¶ added in v0.5.0
func (c CheckResult) String() string
String returns a readable string of the error
func (CheckResult) Unwrap ¶ added in v0.5.0
func (c CheckResult) Unwrap() error
Unwrap implements the Wrapper interface
type ExecutorGetter ¶
type ExecutorGetter interface {
Get(host string) (e executor.TiOpsExecutor)
}
ExecutorGetter get the executor by host.
type Operation ¶
type Operation byte
Operation represents the type of cluster operation
type Options ¶
type Options struct { Roles []string Nodes []string Force bool // Option for upgrade subcommand SSHTimeout int64 // timeout in seconds when connecting an SSH server OptTimeout int64 // timeout in seconds for operations that support it, not to confuse with SSH timeout APITimeout int64 // timeout in seconds for API operations that support it, like transfering store leader }
Options represents the operation options