manager

package
v0.0.0-...-a027a2a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2022 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetClusterSSH

func SetClusterSSH(ctx context.Context, topo spec.Topology, deployUser string, sshTimeout uint64, sshType, defaultSSHType executor.SSHType) error

SetClusterSSH set cluster user ssh executor in context.

func SetSSHKeySet

func SetSSHKeySet(ctx context.Context, privateKeyPath string, publicKeyPath string) error

SetSSHKeySet set ssh key set.

Types

type CheckOptions

type CheckOptions struct {
	User         string // username to login to the SSH server
	IdentityFile string // path to the private key file
	UsePassword  bool   // use password instead of identity file for ssh connection
	Opr          *operator.CheckOptions
	ApplyFix     bool // try to apply fixes of failed checks
	ExistCluster bool // check an exist cluster
}

CheckOptions contains the options for check command

type Cluster

type Cluster struct {
	Name       string `json:"name"`
	User       string `json:"user"`
	Version    string `json:"version"`
	Path       string `json:"path"`
	PrivateKey string `json:"private_key"`
}

Cluster represents a clsuter

type ClusterMetaInfo

type ClusterMetaInfo struct {
	ClusterType    string `json:"cluster_type"`
	ClusterName    string `json:"cluster_name"`
	ClusterVersion string `json:"cluster_version"`
	DeployUser     string `json:"deploy_user"`
	SSHType        string `json:"ssh_type"`
	TLSEnabled     bool   `json:"tls_enabled"`
	TLSCACert      string `json:"tls_ca_cert,omitempty"`
	TLSClientCert  string `json:"tls_client_cert,omitempty"`
	TLSClientKey   string `json:"tls_client_key,omitempty"`
	DashboardURL   string `json:"dashboard_url,omitempty"`
}

ClusterMetaInfo hold the structure for the JSON output of the dashboard info

type DeployOptions

type DeployOptions struct {
	User              string // username to login to the SSH server
	SkipCreateUser    bool   // don't create the user
	IdentityFile      string // path to the private key file
	UsePassword       bool   // use password instead of identity file for ssh connection
	IgnoreConfigCheck bool   // ignore config check result
	NoLabels          bool   // don't check labels for TiKV instance
}

DeployOptions contains the options for scale out.

type DeployerInstance

type DeployerInstance interface {
	Deploy(b *task.Builder, srcPath string, deployDir string, version string, name string, clusterVersion string)
}

DeployerInstance is a instance can deploy to a target deploy directory.

type ExecOptions

type ExecOptions struct {
	Command string
	Sudo    bool
}

ExecOptions for exec shell commanm.

type HostCheckResult

type HostCheckResult struct {
	Node    string `json:"node"`
	Name    string `json:"name"`
	Status  string `json:"status"`
	Message string `json:"message"`
}

HostCheckResult represents the check result of each node

type InstInfo

type InstInfo struct {
	ID        string `json:"id"`
	Role      string `json:"role"`
	Host      string `json:"host"`
	Ports     string `json:"ports"`
	OsArch    string `json:"os_arch"`
	Status    string `json:"status"`
	Since     string `json:"since"`
	DataDir   string `json:"data_dir"`
	DeployDir string `json:"deploy_dir"`

	ComponentName string
	Port          int
}

InstInfo represents an instance info

type JSONOutput

type JSONOutput struct {
	ClusterMetaInfo ClusterMetaInfo `json:"cluster_meta"`
	InstanceInfos   []InstInfo      `json:"instances"`
}

JSONOutput holds the structure for the JSON output of `tiup cluster display --json`

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager to deploy a cluster.

func NewManager

func NewManager(sysName string, specManager *spec.SpecManager, bindVersion spec.BindVersion) *Manager

NewManager create a Manager.

func (*Manager) CheckCluster

func (m *Manager) CheckCluster(clusterOrTopoName string, opt CheckOptions, gOpt operator.Options) error

CheckCluster check cluster before deploying or upgrading

func (*Manager) CleanCluster

func (m *Manager) CleanCluster(name string, gOpt operator.Options, cleanOpt operator.Options, skipConfirm bool) error

CleanCluster cleans the cluster without destroying it

func (*Manager) Deploy

func (m *Manager) Deploy(
	name string,
	clusterVersion string,
	topoFile string,
	opt DeployOptions,
	afterDeploy func(b *task.Builder, newPart spec.Topology),
	skipConfirm bool,
	gOpt operator.Options,
) error

Deploy a cluster.

func (*Manager) DestroyCluster

func (m *Manager) DestroyCluster(name string, gOpt operator.Options, destroyOpt operator.Options, skipConfirm bool) error

DestroyCluster destroy the cluster.

func (*Manager) DestroyTombstone

func (m *Manager) DestroyTombstone(
	name string,
	gOpt operator.Options,
	skipConfirm bool,
) error

DestroyTombstone destroy and remove instances that is in tombstone state

func (*Manager) Display

func (m *Manager) Display(name string, opt operator.Options) error

Display cluster meta and topology.

func (*Manager) EditConfig

func (m *Manager) EditConfig(name string, skipConfirm bool) error

EditConfig lets the user edit the cluster's config.

func (*Manager) EnableCluster

func (m *Manager) EnableCluster(name string, gOpt operator.Options, isEnable bool) error

EnableCluster enable/disable the service in a cluster

func (*Manager) Exec

func (m *Manager) Exec(name string, opt ExecOptions, gOpt operator.Options) error

Exec shell command on host in the tidb cluster.

func (*Manager) GetClusterList

func (m *Manager) GetClusterList() ([]Cluster, error)

GetClusterList get the clusters list.

func (*Manager) GetClusterTopology

func (m *Manager) GetClusterTopology(name string, opt operator.Options) ([]InstInfo, error)

GetClusterTopology get the topology of the cluster.

func (*Manager) ListCluster

func (m *Manager) ListCluster() error

ListCluster list the clusters.

func (*Manager) Patch

func (m *Manager) Patch(name string, packagePath string, opt operator.Options, overwrite, offline, skipConfirm bool) error

Patch the cluster.

func (*Manager) Reload

func (m *Manager) Reload(name string, gOpt operator.Options, skipRestart, skipConfirm bool) error

Reload the cluster.

func (*Manager) Rename

func (m *Manager) Rename(name string, opt operator.Options, newName string, skipConfirm bool) error

Rename the cluster

func (*Manager) RestartCluster

func (m *Manager) RestartCluster(name string, gOpt operator.Options, skipConfirm bool) error

RestartCluster restart the cluster.

func (*Manager) ScaleIn

func (m *Manager) ScaleIn(
	name string,
	skipConfirm bool,
	gOpt operator.Options,
	scale func(builer *task.Builder, metadata spec.Metadata, tlsCfg *tls.Config),
) error

ScaleIn the cluster.

func (*Manager) ScaleOut

func (m *Manager) ScaleOut(
	name string,
	topoFile string,
	afterDeploy func(b *task.Builder, newPart spec.Topology),
	final func(b *task.Builder, name string, meta spec.Metadata),
	opt DeployOptions,
	skipConfirm bool,
	gOpt operator.Options,
) error

ScaleOut scale out the cluster.

func (*Manager) StartCluster

func (m *Manager) StartCluster(name string, gOpt operator.Options, fn ...func(b *task.Builder, metadata spec.Metadata)) error

StartCluster start the cluster with specified name.

func (*Manager) StopCluster

func (m *Manager) StopCluster(name string, gOpt operator.Options, skipConfirm bool) error

StopCluster stop the cluster.

func (*Manager) Transfer

func (m *Manager) Transfer(name string, opt TransferOptions, gOpt operator.Options) error

Transfer copies files from or to host in the tidb cluster.

func (*Manager) Upgrade

func (m *Manager) Upgrade(name string, clusterVersion string, opt operator.Options, skipConfirm, offline bool) error

Upgrade the cluster.

type TransferOptions

type TransferOptions struct {
	Local  string
	Remote string
	Pull   bool // default to push
	Limit  int  // rate limit in Kbit/s
}

TransferOptions for exec shell commanm.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL