mirror of
https://github.com/kubesphere/kubekey.git
synced 2025-12-26 01:22:51 +00:00
fix: backup script doesn't work when set etcd dataDir to another dir except '/var/lib/etcd'
This commit is contained in:
parent
79d1949890
commit
ede57bf951
|
|
@ -406,6 +406,7 @@ func (b *BackupETCD) Execute(runtime connector.Runtime) error {
|
|||
Data: util.Data{
|
||||
"Hostname": runtime.RemoteHost().GetName(),
|
||||
"Etcdendpoint": fmt.Sprintf("https://%s:2379", runtime.RemoteHost().GetInternalAddress()),
|
||||
"DataDir": b.KubeConf.Cluster.Etcd.DataDir,
|
||||
"Backupdir": b.KubeConf.Cluster.Etcd.BackupDir,
|
||||
"KeepbackupNumber": b.KubeConf.Cluster.Etcd.KeepBackupNumber + 1,
|
||||
"EtcdBackupScriptDir": b.KubeConf.Cluster.Etcd.BackupScriptDir,
|
||||
|
|
|
|||
|
|
@ -32,7 +32,11 @@ set -o pipefail
|
|||
|
||||
ETCDCTL_PATH='/usr/local/bin/etcdctl'
|
||||
ENDPOINTS='{{ .Etcdendpoint }}'
|
||||
{{- if .DataDir }}
|
||||
ETCD_DATA_DIR="{{ .DataDir }}"
|
||||
{{- else }}
|
||||
ETCD_DATA_DIR="/var/lib/etcd"
|
||||
{{- end }}
|
||||
BACKUP_DIR="{{ .Backupdir }}/etcd-$(date +%Y-%m-%d-%H-%M-%S)"
|
||||
KEEPBACKUPNUMBER='{{ .KeepbackupNumber }}'
|
||||
ETCDBACKUPSCIPT='{{ .EtcdBackupScriptDir }}'
|
||||
|
|
|
|||
Loading…
Reference in New Issue