Documentation ¶
Overview ¶
Copyright © 2020 Marvin
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func DeleteGlobalDirs(ctx context.Context, host string, options *cluster.GlobalOptions) error
- func DeletePublicKey(ctx context.Context, host string) error
- func Destroy(ctx context.Context, topo *cluster.Topology, options *Options) error
- func DestroyComponent(ctx context.Context, instances []cluster.Instance, cls *cluster.Topology, ...) error
- func Enable(ctx context.Context, topo *cluster.Topology, options *Options, isEnable bool) error
- func EnableComponent(ctx context.Context, instances []cluster.Instance, options *Options, ...) error
- func FilterComponent(comps []cluster.Component, components stringutil.StringSet) (res []cluster.Component)
- func FilterInstance(instances []cluster.Instance, nodes stringutil.StringSet) (res []cluster.Instance)
- func GetServiceStatus(ctx context.Context, e executor.Executor, name string, scope string, ...) (active, memory string, since time.Duration, err error)
- func Restart(ctx context.Context, cluster *cluster.Topology, options *Options, ...) error
- func Start(ctx context.Context, cluster *cluster.Topology, options *Options, ...) error
- func StartComponent(ctx context.Context, instances []cluster.Instance, options *Options, ...) error
- func Stop(ctx context.Context, cluster *cluster.Topology, options *Options) error
- func StopComponent(ctx context.Context, topo *cluster.Topology, instances []cluster.Instance, ...) error
- func Upgrade(ctx context.Context, topo *cluster.Topology, options *Options, ...) error
- type Operation
- type Options
- type SSHConnectionProps
- type SSHCustomScript
- type SSHCustomScripts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteGlobalDirs ¶
DeleteGlobalDirs deletes all global directories if they are empty
func DeletePublicKey ¶
DeletePublicKey deletes the SSH public key from host
func DestroyComponent ¶
func DestroyComponent(ctx context.Context, instances []cluster.Instance, cls *cluster.Topology, options *Options) error
DestroyComponent destroy the instances.
func EnableComponent ¶
func EnableComponent(ctx context.Context, instances []cluster.Instance, options *Options, isEnable bool, systemdMode string) error
EnableComponent enable/disable the instances
func FilterComponent ¶
func FilterComponent(comps []cluster.Component, components stringutil.StringSet) (res []cluster.Component)
FilterComponent filter components by set
func FilterInstance ¶
func FilterInstance(instances []cluster.Instance, nodes stringutil.StringSet) (res []cluster.Instance)
FilterInstance filter instances by set
func GetServiceStatus ¶
func GetServiceStatus(ctx context.Context, e executor.Executor, name string, scope string, systemdMode string) (active, memory string, since time.Duration, 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 Restart ¶
func Restart( ctx context.Context, cluster *cluster.Topology, options *Options, tlsCfg *tls.Config, ) error
Restart the cluster.
func Start ¶
func Start( ctx context.Context, cluster *cluster.Topology, options *Options, tlsCfg *tls.Config, ) error
Start the cluster.
func StartComponent ¶
func StartComponent(ctx context.Context, instances []cluster.Instance, options *Options, tlsCfg *tls.Config, systemdMode string) error
StartComponent start the instances.
Types ¶
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/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 SSHType executor.SSHType // the ssh type: 'builtin', 'system', 'none' 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 SSHCustomScripts SSHCustomScripts // custom scripts to be executed during the operation // 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 tidb server auit log // Some data will be retained when destroying instances RetainDataRoles []string RetainDataNodes []string DisplayMode string // the output format MetaDir string // the metadata dir MirrorDir string // the mirror dir SkipConfirm bool Operation Operation }
Options represents the operation options
type SSHConnectionProps ¶
type SSHConnectionProps struct { Password string IdentityFile string IdentityFilePassphrase string }
SSHConnectionProps is SSHConnectionProps
func ReadIdentityFileOrPassword ¶
func ReadIdentityFileOrPassword(identityFilePath string, usePass bool) (*SSHConnectionProps, error)
ReadIdentityFileOrPassword is ReadIdentityFileOrPassword
type SSHCustomScript ¶
type SSHCustomScript struct {
Raw string
}
SSHCustomScript represents a custom ssh script to be executed during cluster operations
func (SSHCustomScript) Command ¶
func (s SSHCustomScript) Command() string
Command returns the ssh command in string format
type SSHCustomScripts ¶
type SSHCustomScripts struct { BeforeRestartInstance SSHCustomScript AfterRestartInstance SSHCustomScript }
SSHCustomScripts represents the custom ssh script set to be executed during cluster operations