Documentation
¶
Index ¶
- Constants
- Variables
- type BackupComponent
- type Builder
- func (b *Builder) BackupComponent(component, fromVer string, host, deployDir string) *Builder
- func (b *Builder) Build() Task
- func (b *Builder) BuildAsStep(prefix string) *StepDisplay
- func (b *Builder) CheckSys(host, dir, checkType string, topo *spec.Specification, ...) *Builder
- func (b *Builder) ClusterOperate(spec *spec.Specification, op operator.Operation, options operator.Options, ...) *Builder
- func (b *Builder) ClusterSSH(topo spec.Topology, deployUser string, sshTimeout, exeTimeout uint64, ...) *Builder
- func (b *Builder) CopyComponent(component, os, arch string, version string, srcPath, dstHost, dstDir string) *Builder
- func (b *Builder) CopyFile(src, dst, server string, download bool, limit int, compress bool) *Builder
- func (b *Builder) DeploySpark(inst spec.Instance, sparkVersion, srcPath, deployDir string) *Builder
- func (b *Builder) Download(component, os, arch string, version string) *Builder
- func (b *Builder) EnvInit(host, deployUser string, userGroup string, skipCreateUser bool) *Builder
- func (b *Builder) Func(name string, fn func(ctx context.Context) error) *Builder
- func (b *Builder) InitConfig(clusterName, clusterVersion string, specManager *spec.SpecManager, ...) *Builder
- func (b *Builder) InstallPackage(srcPath, dstHost, dstDir string) *Builder
- func (b *Builder) Limit(host, domain, limit, item, value string) *Builder
- func (b *Builder) Mkdir(user, host string, dirs ...string) *Builder
- func (b *Builder) MonitoredConfig(name, comp, host string, globResCtl meta.ResourceControl, ...) *Builder
- func (b *Builder) Parallel(ignoreError bool, tasks ...Task) *Builder
- func (b *Builder) ParallelStep(prefix string, ignoreError bool, tasks ...*StepDisplay) *Builder
- func (b *Builder) Rmdir(host string, dirs ...string) *Builder
- func (b *Builder) RootSSH(host string, port int, user, password, keyFile, passphrase string, ...) *Builder
- func (b *Builder) RotateSSH(host, deployUser, newPublicKeyPath string) *Builder
- func (b *Builder) SSHKeyGen(keypath string) *Builder
- func (b *Builder) SSHKeySet(privKeyPath, pubKeyPath string) *Builder
- func (b *Builder) ScaleConfig(clusterName, clusterVersion string, specManager *spec.SpecManager, ...) *Builder
- func (b *Builder) Serial(tasks ...Task) *Builder
- func (b *Builder) Shell(host, command, cmdID string, sudo bool) *Builder
- func (b *Builder) Step(prefix string, inner Task, logger *logprinter.Logger) *Builder
- func (b *Builder) Sysctl(host, key, val string) *Builder
- func (b *Builder) SystemCtl(host, unit, action string, daemonReload, checkActive bool) *Builder
- func (b *Builder) TLSCert(host, comp, role string, port int, ca *crypto.CertificateAuthority, ...) *Builder
- func (b *Builder) UpdateMeta(cluster string, metadata *spec.ClusterMeta, deletedNodeIds []string) *Builder
- func (b *Builder) UpdateTopology(cluster, profile string, metadata *spec.ClusterMeta, deletedNodeIds []string) *Builder
- func (b *Builder) UserSSH(host string, port int, deployUser string, sshTimeout, exeTimeout uint64, ...) *Builder
- type CheckSys
- type ClusterOperate
- type CopyComponent
- type CopyFile
- type Downloader
- type EnvInit
- type Func
- type InitConfig
- type InstallPackage
- type Limit
- type Mkdir
- type MonitoredConfig
- type Parallel
- type ParallelStepDisplay
- type Rmdir
- type RootSSH
- type RotateSSH
- type SSHKeyGen
- type SSHKeySet
- type ScaleConfig
- type Serial
- type Shell
- type StepDisplay
- type Sysctl
- type SystemCtl
- type TLSCert
- type Task
- type UpdateMeta
- type UpdateTopology
- type UserSSH
Constants ¶
const (
CheckToolsPathDir = "/tmp/tiup"
)
place the check utilities are stored
Variables ¶
var ( CheckTypeSystemInfo = "insight" CheckTypeSystemLimits = "limits" CheckTypeSystemConfig = "system" CheckTypePort = "port" CheckTypeService = "service" CheckTypePackage = "package" CheckTypePartitions = "partitions" CheckTypeFIO = "fio" CheckTypePermission = "permission" ChecktypeIsExist = "exist" CheckTypeTimeZone = "timezone" )
the check types
var ( // ErrUnsupportedRollback means the task do not support rollback. ErrUnsupportedRollback = stderrors.New("unsupported rollback") // ErrNoExecutor means not being able to get the executor. ErrNoExecutor = stderrors.New("no executor") // ErrNoOutput means not being able to get the output of host. ErrNoOutput = stderrors.New("no outputs available") )
var (
// ErrEnvInitFailed is ErrEnvInitFailed
ErrEnvInitFailed = errNSEnvInit.NewType("failed")
)
Functions ¶
This section is empty.
Types ¶
type BackupComponent ¶
type BackupComponent struct {
// contains filtered or unexported fields
}
BackupComponent is used to copy all files related the specific version a component to the target directory of path
func (*BackupComponent) Execute ¶
func (c *BackupComponent) Execute(ctx context.Context) error
Execute implements the Task interface
func (*BackupComponent) Rollback ¶
func (c *BackupComponent) Rollback(ctx context.Context) error
Rollback implements the Task interface
func (*BackupComponent) String ¶
func (c *BackupComponent) String() string
String implements the fmt.Stringer interface
type Builder ¶
type Builder struct { Logger *logprinter.Logger // contains filtered or unexported fields }
Builder is used to build TiUP task
func NewBuilder ¶
func NewBuilder(logger *logprinter.Logger) *Builder
NewBuilder returns a *Builder instance
func NewSimpleUerSSH ¶ added in v1.9.0
func NewSimpleUerSSH(logger *logprinter.Logger, host string, port int, user string, gOpt operator.Options, p *tui.SSHConnectionProps, sshType executor.SSHType) *Builder
NewSimpleUerSSH append a UserSSH task to the current task collection with operator.Options and SSHConnectionProps
func (*Builder) BackupComponent ¶
BackupComponent appends a BackupComponent task to the current task collection
func (*Builder) BuildAsStep ¶
func (b *Builder) BuildAsStep(prefix string) *StepDisplay
BuildAsStep returns a task that is wrapped by a StepDisplay. The task will print single line progress.
func (*Builder) CheckSys ¶
func (b *Builder) CheckSys(host, dir, checkType string, topo *spec.Specification, opt *operator.CheckOptions) *Builder
CheckSys checks system information of deploy server
func (*Builder) ClusterOperate ¶
func (b *Builder) ClusterOperate( spec *spec.Specification, op operator.Operation, options operator.Options, tlsCfg *tls.Config, ) *Builder
ClusterOperate appends a cluster operation task. All the UserSSH needed must be init first.
func (*Builder) ClusterSSH ¶
func (b *Builder) ClusterSSH( topo spec.Topology, deployUser string, sshTimeout, exeTimeout uint64, proxyHost string, proxyPort int, proxyUser, proxyPassword, proxyKeyFile, proxyPassphrase string, proxySSHTimeout uint64, sshType, defaultSSHType executor.SSHType, ) *Builder
ClusterSSH init all UserSSH need for the cluster.
func (*Builder) CopyComponent ¶
func (b *Builder) CopyComponent(component, os, arch string, version string, srcPath, dstHost, dstDir string, ) *Builder
CopyComponent appends a CopyComponent task to the current task collection
func (*Builder) CopyFile ¶
func (b *Builder) CopyFile(src, dst, server string, download bool, limit int, compress bool) *Builder
CopyFile appends a CopyFile task to the current task collection
func (*Builder) DeploySpark ¶ added in v1.0.9
DeploySpark deployes spark as dependency of TiSpark
func (*Builder) InitConfig ¶
func (b *Builder) InitConfig(clusterName, clusterVersion string, specManager *spec.SpecManager, inst spec.Instance, deployUser string, ignoreCheck bool, paths meta.DirPaths) *Builder
InitConfig appends a CopyComponent task to the current task collection
func (*Builder) InstallPackage ¶
InstallPackage appends a InstallPackage task to the current task collection
func (*Builder) MonitoredConfig ¶
func (b *Builder) MonitoredConfig(name, comp, host string, globResCtl meta.ResourceControl, options *spec.MonitoredOptions, deployUser string, tlsEnabled bool, paths meta.DirPaths) *Builder
MonitoredConfig appends a CopyComponent task to the current task collection
func (*Builder) ParallelStep ¶
func (b *Builder) ParallelStep(prefix string, ignoreError bool, tasks ...*StepDisplay) *Builder
ParallelStep appends a new ParallelStepDisplay task, which will print multi line progress in parallel for inner tasks. Inner tasks must be a StepDisplay task.
func (*Builder) RootSSH ¶
func (b *Builder) RootSSH( host string, port int, user, password, keyFile, passphrase string, sshTimeout, exeTimeout uint64, proxyHost string, proxyPort int, proxyUser, proxyPassword, proxyKeyFile, proxyPassphrase string, proxySSHTimeout uint64, sshType, defaultSSHType executor.SSHType, ) *Builder
RootSSH appends a RootSSH task to the current task collection
func (*Builder) RotateSSH ¶ added in v1.12.0
RotateSSH appends a RotateSSH task to the current task collection
func (*Builder) ScaleConfig ¶
func (b *Builder) ScaleConfig(clusterName, clusterVersion string, specManager *spec.SpecManager, topo spec.Topology, inst spec.Instance, deployUser string, paths meta.DirPaths) *Builder
ScaleConfig generate temporary config on scaling
func (*Builder) Step ¶
Step appends a new StepDisplay task, which will print single line progress for inner tasks.
func (*Builder) TLSCert ¶ added in v1.2.0
func (b *Builder) TLSCert(host, comp, role string, port int, ca *crypto.CertificateAuthority, paths meta.DirPaths) *Builder
TLSCert generates certificate for instance and transfers it to the server
func (*Builder) UpdateMeta ¶
func (b *Builder) UpdateMeta(cluster string, metadata *spec.ClusterMeta, deletedNodeIds []string) *Builder
UpdateMeta maintain the meta information
func (*Builder) UpdateTopology ¶
func (b *Builder) UpdateTopology(cluster, profile string, metadata *spec.ClusterMeta, deletedNodeIds []string) *Builder
UpdateTopology maintain the topology information
func (*Builder) UserSSH ¶
func (b *Builder) UserSSH( host string, port int, deployUser string, sshTimeout, exeTimeout uint64, proxyHost string, proxyPort int, proxyUser, proxyPassword, proxyKeyFile, proxyPassphrase string, proxySSHTimeout uint64, sshType, defaultSSHType executor.SSHType, ) *Builder
UserSSH append a UserSSH task to the current task collection
type CheckSys ¶
type CheckSys struct {
// contains filtered or unexported fields
}
CheckSys performs checks of system information
type ClusterOperate ¶
type ClusterOperate struct {
// contains filtered or unexported fields
}
ClusterOperate represents the cluster operation task.
func (*ClusterOperate) Execute ¶
func (c *ClusterOperate) Execute(ctx context.Context) error
Execute implements the Task interface
func (*ClusterOperate) Rollback ¶
func (c *ClusterOperate) Rollback(ctx context.Context) error
Rollback implements the Task interface
func (*ClusterOperate) String ¶
func (c *ClusterOperate) String() string
String implements the fmt.Stringer interface
type CopyComponent ¶
type CopyComponent struct {
// contains filtered or unexported fields
}
CopyComponent is used to copy all files related the specific version a component to the target directory of path
func (*CopyComponent) Execute ¶
func (c *CopyComponent) Execute(ctx context.Context) error
Execute implements the Task interface
func (*CopyComponent) Rollback ¶
func (c *CopyComponent) Rollback(ctx context.Context) error
Rollback implements the Task interface
func (*CopyComponent) String ¶
func (c *CopyComponent) String() string
String implements the fmt.Stringer interface
type CopyFile ¶
type CopyFile struct {
// contains filtered or unexported fields
}
CopyFile will copy a local file to the target host
type Downloader ¶
type Downloader struct {
// contains filtered or unexported fields
}
Downloader is used to download the specific version of a component from the repository, there is nothing to do if the specified version exists.
func NewDownloader ¶
func NewDownloader(component string, os string, arch string, version string) *Downloader
NewDownloader create a Downloader instance.
func (*Downloader) Execute ¶
func (d *Downloader) Execute(_ context.Context) error
Execute implements the Task interface
func (*Downloader) Rollback ¶
func (d *Downloader) Rollback(ctx context.Context) error
Rollback implements the Task interface
func (*Downloader) String ¶
func (d *Downloader) String() string
String implements the fmt.Stringer interface
type EnvInit ¶
type EnvInit struct {
// contains filtered or unexported fields
}
EnvInit is used to initialize the remote environment, e.g: 1. Generate SSH key 2. ssh-copy-id
type Func ¶
type Func struct {
// contains filtered or unexported fields
}
Func wrap a closure.
type InitConfig ¶
type InitConfig struct {
// contains filtered or unexported fields
}
InitConfig is used to copy all configurations to the target directory of path
func (*InitConfig) Execute ¶
func (c *InitConfig) Execute(ctx context.Context) error
Execute implements the Task interface
func (*InitConfig) Rollback ¶
func (c *InitConfig) Rollback(ctx context.Context) error
Rollback implements the Task interface
func (*InitConfig) String ¶
func (c *InitConfig) String() string
String implements the fmt.Stringer interface
type InstallPackage ¶
type InstallPackage struct {
// contains filtered or unexported fields
}
InstallPackage is used to copy all files related the specific version a component to the target directory of path
func (*InstallPackage) Execute ¶
func (c *InstallPackage) Execute(ctx context.Context) error
Execute implements the Task interface
func (*InstallPackage) Rollback ¶
func (c *InstallPackage) Rollback(ctx context.Context) error
Rollback implements the Task interface
func (*InstallPackage) String ¶
func (c *InstallPackage) String() string
String implements the fmt.Stringer interface
type Limit ¶
type Limit struct {
// contains filtered or unexported fields
}
Limit set a system limit on host
type Mkdir ¶
type Mkdir struct {
// contains filtered or unexported fields
}
Mkdir is used to create directory on the target host
type MonitoredConfig ¶
type MonitoredConfig struct {
// contains filtered or unexported fields
}
MonitoredConfig is used to generate the monitor node configuration
func (*MonitoredConfig) Execute ¶
func (m *MonitoredConfig) Execute(ctx context.Context) error
Execute implements the Task interface
func (*MonitoredConfig) Rollback ¶
func (m *MonitoredConfig) Rollback(ctx context.Context) error
Rollback implements the Task interface
func (*MonitoredConfig) String ¶
func (m *MonitoredConfig) String() string
String implements the fmt.Stringer interface
type Parallel ¶
type Parallel struct {
// contains filtered or unexported fields
}
Parallel will execute a bundle of task in parallelism way
type ParallelStepDisplay ¶
type ParallelStepDisplay struct { Logger *logprinter.Logger // contains filtered or unexported fields }
ParallelStepDisplay is a task that will display multiple progress bars in parallel for inner tasks. Inner tasks will be executed in parallel.
func (*ParallelStepDisplay) Execute ¶
func (ps *ParallelStepDisplay) Execute(ctx context.Context) error
Execute implements the Task interface
func (*ParallelStepDisplay) Rollback ¶
func (ps *ParallelStepDisplay) Rollback(ctx context.Context) error
Rollback implements the Task interface
func (*ParallelStepDisplay) SetLogger ¶ added in v1.9.0
func (ps *ParallelStepDisplay) SetLogger(logger *logprinter.Logger) *ParallelStepDisplay
SetLogger set the logger of step
func (*ParallelStepDisplay) String ¶
func (ps *ParallelStepDisplay) String() string
String implements the fmt.Stringer interface
type Rmdir ¶
type Rmdir struct {
// contains filtered or unexported fields
}
Rmdir is used to delete directory on the target host
type RootSSH ¶
type RootSSH struct {
// contains filtered or unexported fields
}
RootSSH is used to establish a SSH connection to the target host with specific key
type RotateSSH ¶ added in v1.12.0
type RotateSSH struct {
// contains filtered or unexported fields
}
RotateSSH is used to rotate ssh key, e.g: 1. enable new public key 2. revoke old public key
type SSHKeyGen ¶
type SSHKeyGen struct {
// contains filtered or unexported fields
}
SSHKeyGen is used to generate SSH key
type SSHKeySet ¶
type SSHKeySet struct {
// contains filtered or unexported fields
}
SSHKeySet is used to set the Context private/public key path
type ScaleConfig ¶
type ScaleConfig struct {
// contains filtered or unexported fields
}
ScaleConfig is used to copy all configurations to the target directory of path
func (*ScaleConfig) Execute ¶
func (c *ScaleConfig) Execute(ctx context.Context) error
Execute implements the Task interface
func (*ScaleConfig) Rollback ¶
func (c *ScaleConfig) Rollback(ctx context.Context) error
Rollback implements the Task interface
func (*ScaleConfig) String ¶
func (c *ScaleConfig) String() string
String implements the fmt.Stringer interface
type Serial ¶
type Serial struct {
// contains filtered or unexported fields
}
Serial will execute a bundle of task in serialized way
type Shell ¶
type Shell struct {
// contains filtered or unexported fields
}
Shell is used to create directory on the target host
type StepDisplay ¶
type StepDisplay struct { Logger *logprinter.Logger // contains filtered or unexported fields }
StepDisplay is a task that will display a progress bar for inner task.
func (*StepDisplay) Execute ¶
func (s *StepDisplay) Execute(ctx context.Context) error
Execute implements the Task interface
func (*StepDisplay) Rollback ¶
func (s *StepDisplay) Rollback(ctx context.Context) error
Rollback implements the Task interface
func (*StepDisplay) SetHidden ¶
func (s *StepDisplay) SetHidden(h bool) *StepDisplay
SetHidden set step hidden or not.
func (*StepDisplay) SetLogger ¶ added in v1.9.0
func (s *StepDisplay) SetLogger(logger *logprinter.Logger) *StepDisplay
SetLogger set the logger of step
func (*StepDisplay) String ¶
func (s *StepDisplay) String() string
String implements the fmt.Stringer interface
type Sysctl ¶
type Sysctl struct {
// contains filtered or unexported fields
}
Sysctl set a kernel param on host
type SystemCtl ¶
type SystemCtl struct {
// contains filtered or unexported fields
}
SystemCtl run systemctl command on host
type TLSCert ¶ added in v1.2.0
type TLSCert struct {
// contains filtered or unexported fields
}
TLSCert generates a certificate for instance
type Task ¶
type Task interface { fmt.Stringer Execute(ctx context.Context) error Rollback(ctx context.Context) error }
Task represents a operation while TiUP execution
type UpdateMeta ¶
type UpdateMeta struct {
// contains filtered or unexported fields
}
UpdateMeta is used to maintain the cluster meta information
func (*UpdateMeta) Execute ¶
func (u *UpdateMeta) Execute(ctx context.Context) error
Execute implements the Task interface the metadata especially the topology is in wide use, the other callers point to this field by a pointer, so we should update the original topology directly, and don't make a copy
func (*UpdateMeta) Rollback ¶
func (u *UpdateMeta) Rollback(ctx context.Context) error
Rollback implements the Task interface
func (*UpdateMeta) String ¶
func (u *UpdateMeta) String() string
String implements the fmt.Stringer interface
type UpdateTopology ¶
type UpdateTopology struct {
// contains filtered or unexported fields
}
UpdateTopology is used to maintain the cluster meta information
func (*UpdateTopology) Execute ¶
func (u *UpdateTopology) Execute(ctx context.Context) error
Execute implements the Task interface
func (*UpdateTopology) Rollback ¶
func (u *UpdateTopology) Rollback(ctx context.Context) error
Rollback implements the Task interface
func (*UpdateTopology) String ¶
func (u *UpdateTopology) String() string
String implements the fmt.Stringer interface
Source Files
¶
- action.go
- backup_component.go
- builder.go
- check.go
- copy_component.go
- copy_file.go
- download.go
- env_init.go
- func.go
- init_config.go
- install_package.go
- limits.go
- mkdir.go
- monitored_config.go
- rmdir.go
- rotate_ssh.go
- scale_config.go
- shell.go
- ssh.go
- ssh_keygen.go
- ssh_keyset.go
- step.go
- sysctl.go
- systemd.go
- task.go
- tls.go
- update_meta.go
- update_topology.go