operation

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupComponent

func CleanupComponent(ctx context.Context, delFileMaps map[string]set.StringSet) error

CleanupComponent cleanup the instances

func DeleteGlobalDirs

func DeleteGlobalDirs(ctx context.Context, host string, options *spec.GlobalOptions) error

DeleteGlobalDirs deletes all global directories if they are empty

func DeletePublicKey

func DeletePublicKey(ctx context.Context, host string) error

DeletePublicKey deletes the SSH public key from host

func DestroyComponent

func DestroyComponent(ctx context.Context, instances []spec.Instance, cls spec.Topology, options Options) error

DestroyComponent destroy the instances.

func DestroyMonitored

func DestroyMonitored(ctx context.Context, inst spec.Instance, options *spec.TSMonitoredOptions, timeout uint64) error

DestroyMonitored destroy the monitored service.

func Download

func Download(prefix, component, nodeOS, arch, version string) error

Download downloads the specific version of a component from the mirror repository, there is nothing to do if the specified version exists.

func EnableComponent

func EnableComponent(ctx context.Context, instances []spec.Instance, noAgentHosts set.StringSet, options Options, isEnable bool) error

EnableComponent enable/disable the instances

func EnableMonitored

func EnableMonitored(ctx context.Context, hosts []string, noAgentHosts set.StringSet, timeout uint64, isEnable bool) error

EnableMonitored enable/disable monitor service in a cluster

func FilterComponent

func FilterComponent(comps []spec.Component, components set.StringSet) (res []spec.Component)

FilterComponent filter components by set

func FilterInstance

func FilterInstance(instances []spec.Instance, nodes set.StringSet) (res []spec.Instance)

FilterInstance filter instances by set

func Restart

func Restart(
	ctx context.Context,
	cluster spec.Topology,
	options Options,
	tlsCfg *tls.Config,
) error

Restart the cluster.

func RestartMonitored

func RestartMonitored(ctx context.Context, hosts []string, noAgentHosts set.StringSet, timeout uint64) error

RestartMonitored stop BlackboxExporter and NodeExporter

func Start

func Start(
	ctx context.Context,
	cluster spec.Topology,
	options Options,
	tlsCfg *tls.Config,
) error

Start the cluster.

func StartComponent

func StartComponent(ctx context.Context, instances []spec.Instance, options Options, tlsCfg *tls.Config) error

StartComponent start the instances.

func StartMonitored

func StartMonitored(ctx context.Context, hosts []string, noAgentHosts set.StringSet, timeout uint64) error

StartMonitored start BlackboxExporter and NodeExporter

func Stop

func Stop(
	ctx context.Context,
	cluster spec.Topology,
	options Options,
) error

Stop the cluster.

func StopComponent

func StopComponent(ctx context.Context,
	instances []spec.Instance,
	options Options,
	forceStop bool,
) error

StopComponent stop the instances.

func StopMonitored

func StopMonitored(ctx context.Context, hosts []string, noAgentHosts set.StringSet, timeout uint64) error

StopMonitored stop BlackboxExporter and NodeExporter

func Uninstall

func Uninstall(
	ctx context.Context,
	cluster spec.Topology,
	options Options,
) error

Uninstall the cluster.

Types

type DownloadOptions

type DownloadOptions struct {
	Version string
	Os      string
	Arch    string
}

type Downloader

type Downloader interface {
	Run() error
	// contains filtered or unexported methods
}

func NewGeminiDownloader

func NewGeminiDownloader(ops DownloadOptions) Downloader

type Executor

type Executor interface {
	ExecRunAction(action *RunAction, errChan chan error) string
	ExecStopAction(action *StopAction) (string, error)
	ExecCommand(ip string, command string) (string, error)
}

func NewGeminiExecutor

func NewGeminiExecutor(clients map[string]*ssh.Client) Executor

type GeminiDownloader

type GeminiDownloader struct {
	Url string
	// contains filtered or unexported fields
}

func (*GeminiDownloader) CleanFile

func (d *GeminiDownloader) CleanFile(dir string)

func (*GeminiDownloader) Run

func (d *GeminiDownloader) Run() error

type GeminiExecutor

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

func (*GeminiExecutor) ExecCommand

func (e *GeminiExecutor) ExecCommand(ip string, command string) (string, error)

func (*GeminiExecutor) ExecRunAction

func (e *GeminiExecutor) ExecRunAction(action *RunAction, errChan chan error) string

func (*GeminiExecutor) ExecStopAction

func (e *GeminiExecutor) ExecStopAction(action *StopAction) (string, error)

type Options

type Options struct {
	Roles               []string
	Nodes               []string
	Force               bool   // Option for upgrade/tls subcommand
	SSHTimeout          uint64 // timeout in seconds when connecting an SSH server
	OptTimeout          uint64 // timeout in seconds for operations that support it, not to confuse with SSH timeout
	APITimeout          uint64 // timeout in seconds for API operations that support it, like transferring store leader
	IgnoreConfigCheck   bool   // should we ignore the config check result after init config
	Concurrency         int    // max number of parallel tasks to run
	SSHProxyHost        string // the ssh proxy host
	SSHProxyPort        int    // the ssh proxy port
	SSHProxyUser        string // the ssh proxy user
	SSHProxyIdentity    string // the ssh proxy identity file
	SSHProxyUsePassword bool   // use password instead of identity file for ssh proxy connection
	SSHProxyTimeout     uint64 // timeout in seconds when connecting the proxy host

	// What type of things should we cleanup in clean command
	CleanupData     bool // should we cleanup data
	CleanupLog      bool // should we clenaup log
	CleanupAuditLog bool // should we clenaup openGemini server auit log

	// Some data will be retained when destroying instances
	RetainDataRoles []string
	RetainDataNodes []string

	DisplayMode string // the output format

}

Options represents the operation options

type RunAction

type RunAction struct {
	User   string
	Info   *RunInfo
	Remote *config.RemoteHost
}

type RunActions

type RunActions struct {
	MetaAction  []*RunAction
	SqlAction   []*RunAction
	StoreAction []*RunAction
}

type RunInfo

type RunInfo struct {
	ScriptPath string
	Args       []string
}

type StopAction

type StopAction struct {
	ProcessNames []string
	Remote       *config.RemoteHost
}

Jump to

Keyboard shortcuts

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