mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-09-11 17:15:44 +08:00
fix: Fixed issue with recover postgres-cluster database failed (#9732)
This commit is contained in:
parent
4565c5b300
commit
04b9cbd87a
3 changed files with 68 additions and 61 deletions
|
@ -136,7 +136,11 @@ func (r *Local) Backup(info BackupInfo) error {
|
|||
}
|
||||
defer outfile.Close()
|
||||
global.LOG.Infof("start to pg_dump | gzip > %s.gzip", info.TargetDir+"/"+info.FileName)
|
||||
cmd := exec.Command("docker", "exec", "-e", fmt.Sprintf("PGPASSWORD=%s", r.Password), r.ContainerName, "pg_dump", "-F", "c", "-U", r.Username, "-d", info.Name)
|
||||
cmd := exec.Command(
|
||||
"docker", "exec", "-i", r.ContainerName,
|
||||
"sh", "-c",
|
||||
fmt.Sprintf("PGPASSWORD=%s pg_dump -F c -U %s -d %s", r.Password, r.Username, info.Name),
|
||||
)
|
||||
var stderr bytes.Buffer
|
||||
cmd.Stderr = &stderr
|
||||
|
||||
|
@ -155,7 +159,9 @@ func (r *Local) Backup(info BackupInfo) error {
|
|||
func (r *Local) Recover(info RecoverInfo) error {
|
||||
fi, _ := os.Open(info.SourceFile)
|
||||
defer fi.Close()
|
||||
cmd := exec.Command("docker", "exec", "-i", r.ContainerName, "pg_restore", "-F", "c", "-c", "-U", r.Username, "-d", info.Name)
|
||||
cmd := exec.Command("docker", "exec", r.ContainerName, "sh", "-c",
|
||||
fmt.Sprintf("PGPASSWORD=%s pg_dump -F c -U %s -d %s", r.Password, r.Username, info.Name),
|
||||
)
|
||||
if strings.HasSuffix(info.SourceFile, ".gz") {
|
||||
gzipFile, err := os.Open(info.SourceFile)
|
||||
if err != nil {
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, useSlots } from 'vue';
|
||||
import { computed, useSlots, ref } from 'vue';
|
||||
defineOptions({ name: 'DrawerPro' });
|
||||
import i18n from '@/lang';
|
||||
import { GlobalStore } from '@/store';
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
:header="$t('commons.button.' + operateReq.operate)"
|
||||
:resource="resourceName"
|
||||
@close="handleClose"
|
||||
v-loading="loading"
|
||||
>
|
||||
<div v-loading="loading">
|
||||
<el-descriptions direction="vertical">
|
||||
<el-descriptions-item>
|
||||
<el-link @click="toLink(app.website)">
|
||||
|
@ -66,6 +66,7 @@
|
|||
</div>
|
||||
<CodemirrorPro v-if="useNewCompose" v-model="newCompose" mode="yaml"></CodemirrorPro>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="handleClose" :disabled="loading">{{ $t('commons.button.cancel') }}</el-button>
|
||||
|
|
Loading…
Add table
Reference in a new issue