manager

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetClusterSSH added in v1.4.0

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 added in v1.4.0

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

SetSSHKeySet set ssh key set.

Types

type CheckOptions added in v1.4.0

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 added in v1.4.0

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 added in v1.5.0

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"`
	GrafanaURLS    []string `json:"grafana_urls,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
	NoLabels       bool   // don't check labels for TiKV instance
	Stage1         bool   // don't start the new instance, just deploy
	Stage2         bool   // start instances and init Config after stage1
}

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 DisplayOption added in v1.11.0

type DisplayOption struct {
	ClusterName    string
	ShowUptime     bool
	ShowProcess    bool
	ShowManageHost bool
	ShowNuma       bool
	ShowVersions   bool
}

DisplayOption represents option of display command

type EditConfigOptions added in v1.8.0

type EditConfigOptions struct {
	NewTopoFile string // path to new topology file to substitute the original one
}

EditConfigOptions contains the options for config edition.

type ExecOptions

type ExecOptions struct {
	Command string
	Sudo    bool
}

ExecOptions for exec shell commanm.

type HostCheckResult added in v1.4.0

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 added in v1.4.0

type InstInfo struct {
	ID          string `json:"id"`
	Role        string `json:"role"`
	Host        string `json:"host"`
	ManageHost  string `json:"manage_host"`
	Ports       string `json:"ports"`
	OsArch      string `json:"os_arch"`
	Status      string `json:"status"`
	Memory      string `json:"memory"`
	MemoryLimit string `json:"memory_limit"`
	CPUquota    string `json:"cpu_quota"`
	Since       string `json:"since"`
	DataDir     string `json:"data_dir"`
	DeployDir   string `json:"deploy_dir"`
	NumaNode    string `json:"numa_node"`
	NumaCores   string `json:"numa_cores"`
	Version     string `json:"version"`

	ComponentName string
	Port          int
}

InstInfo represents an instance info

type JSONOutput added in v1.5.0

type JSONOutput struct {
	ClusterMetaInfo ClusterMetaInfo `json:"cluster_meta"`
	InstanceInfos   []InstInfo      `json:"instances,omitempty"`
	LocationLabel   string          `json:"location_label,omitempty"`
	LabelInfos      []api.LabelInfo `json:"labels,omitempty"`
}

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

type LabelInfo added in v1.7.0

type LabelInfo struct {
	Machine   string `json:"machine"`
	Port      string `json:"port"`
	Store     string `json:"store"`
	Status    string `json:"status"`
	Leaders   string `json:"leaders"`
	Regions   string `json:"regions"`
	Capacity  string `json:"capacity"`
	Available string `json:"available"`
	Labels    string `json:"labels"`
}

LabelInfo represents an instance label info

type Manager

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

Manager to deploy a cluster.

func NewManager

func NewManager(
	sysName string,
	specManager *spec.SpecManager,
	logger *logprinter.Logger,
) *Manager

NewManager create a Manager.

func (*Manager) BackupClusterMeta added in v1.10.0

func (m *Manager) BackupClusterMeta(clusterName, filePath string) error

BackupClusterMeta backup cluster meta to given filepath

func (*Manager) CheckCluster added in v1.4.0

func (m *Manager) CheckCluster(clusterOrTopoName, scaleoutTopo 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, gOpt operator.Options),
	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(dopt DisplayOption, opt operator.Options) error

Display cluster meta and topology.

func (*Manager) DisplayDashboardInfo added in v1.9.0

func (m *Manager) DisplayDashboardInfo(clusterName string, timeout time.Duration, tlsCfg *tls.Config) error

DisplayDashboardInfo prints the dashboard address of cluster

func (*Manager) DisplayTiKVLabels added in v1.7.0

func (m *Manager) DisplayTiKVLabels(dopt DisplayOption, opt operator.Options) error

DisplayTiKVLabels display cluster tikv labels

func (*Manager) EditConfig

func (m *Manager) EditConfig(name string, opt EditConfigOptions, 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 added in v1.4.0

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

GetClusterList get the clusters list.

func (*Manager) GetClusterTopology added in v1.4.0

func (m *Manager) GetClusterTopology(dopt DisplayOption, 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) RestoreClusterMeta added in v1.10.0

func (m *Manager) RestoreClusterMeta(clusterName, filePath string, skipConfirm bool) error

RestoreClusterMeta restore cluster meta by given filepath

func (*Manager) RotateSSH added in v1.12.0

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

RotateSSH rotate public keys of target nodes

func (*Manager) ScaleIn

func (m *Manager) ScaleIn(
	name string,
	skipConfirm bool,
	gOpt operator.Options,
	scale func(builder *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, gOpt operator.Options),
	final func(b *task.Builder, name string, meta spec.Metadata, gOpt operator.Options),
	opt DeployOptions,
	skipConfirm bool,
	gOpt operator.Options,
) error

ScaleOut scale out the cluster.

func (*Manager) ShowConfig added in v1.8.0

func (m *Manager) ShowConfig(name string) error

ShowConfig shows the cluster's config.

func (*Manager) StartCluster

func (m *Manager) StartCluster(name string, gOpt operator.Options, restoreLeader bool, 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,
	evictLeader bool,
) error

StopCluster stop the cluster.

func (*Manager) TLS added in v1.9.0

func (m *Manager) TLS(name string, gOpt operator.Options, enable, cleanCertificate, reloadCertificate, skipConfirm bool) error

TLS set cluster enable/disable encrypt communication by tls

func (*Manager) Transfer added in v1.4.0

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, componentVersions map[string]string, opt operator.Options, skipConfirm, offline, ignoreVersionCheck bool) error

Upgrade the cluster.

type TransferOptions added in v1.4.0

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

TransferOptions for exec shell commanm.

Jump to

Keyboard shortcuts

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