fix(snapshot): 修改 Services PostgreSQL 用户名为 rwa_user
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
bc38ec6ec0
commit
b5105d6bd1
|
|
@ -131,7 +131,7 @@ do_backup() {
|
||||||
# Services PostgreSQL
|
# Services PostgreSQL
|
||||||
if docker ps --format '{{.Names}}' | grep -q "^${SERVICES_POSTGRES_CONTAINER}$"; then
|
if docker ps --format '{{.Names}}' | grep -q "^${SERVICES_POSTGRES_CONTAINER}$"; then
|
||||||
log_info "导出 Services PostgreSQL..."
|
log_info "导出 Services PostgreSQL..."
|
||||||
if docker exec "$SERVICES_POSTGRES_CONTAINER" pg_dumpall -U postgres > "$backup_dir/services_postgres_dump.sql" 2>>"$log_file"; then
|
if docker exec "$SERVICES_POSTGRES_CONTAINER" pg_dumpall -U rwa_user > "$backup_dir/services_postgres_dump.sql" 2>>"$log_file"; then
|
||||||
log_info "✓ Services PostgreSQL 导出完成 ($(du -h "$backup_dir/services_postgres_dump.sql" | cut -f1))"
|
log_info "✓ Services PostgreSQL 导出完成 ($(du -h "$backup_dir/services_postgres_dump.sql" | cut -f1))"
|
||||||
else
|
else
|
||||||
log_warn "Services PostgreSQL 导出失败"
|
log_warn "Services PostgreSQL 导出失败"
|
||||||
|
|
@ -259,7 +259,7 @@ $(ls -lh "$backup_dir" | tail -n +2)
|
||||||
./snapshot.sh restore $backup_dir
|
./snapshot.sh restore $backup_dir
|
||||||
|
|
||||||
# 或手动恢复 PostgreSQL
|
# 或手动恢复 PostgreSQL
|
||||||
docker exec -i $SERVICES_POSTGRES_CONTAINER psql -U postgres < $backup_dir/services_postgres_dump.sql
|
docker exec -i $SERVICES_POSTGRES_CONTAINER psql -U rwa_user < $backup_dir/services_postgres_dump.sql
|
||||||
docker exec -i $MPC_POSTGRES_CONTAINER psql -U postgres < $backup_dir/mpc_postgres_dump.sql
|
docker exec -i $MPC_POSTGRES_CONTAINER psql -U postgres < $backup_dir/mpc_postgres_dump.sql
|
||||||
|
|
||||||
===========================================
|
===========================================
|
||||||
|
|
@ -350,7 +350,7 @@ restore_postgres() {
|
||||||
if [ -f "$backup_dir/services_postgres_dump.sql" ]; then
|
if [ -f "$backup_dir/services_postgres_dump.sql" ]; then
|
||||||
if docker ps --format '{{.Names}}' | grep -q "^${SERVICES_POSTGRES_CONTAINER}$"; then
|
if docker ps --format '{{.Names}}' | grep -q "^${SERVICES_POSTGRES_CONTAINER}$"; then
|
||||||
log_info "恢复 Services PostgreSQL..."
|
log_info "恢复 Services PostgreSQL..."
|
||||||
if docker exec -i "$SERVICES_POSTGRES_CONTAINER" psql -U postgres < "$backup_dir/services_postgres_dump.sql" 2>/dev/null; then
|
if docker exec -i "$SERVICES_POSTGRES_CONTAINER" psql -U rwa_user < "$backup_dir/services_postgres_dump.sql" 2>/dev/null; then
|
||||||
log_info "✓ Services PostgreSQL 恢复完成"
|
log_info "✓ Services PostgreSQL 恢复完成"
|
||||||
else
|
else
|
||||||
log_warn "Services PostgreSQL 恢复可能有警告(通常是正常的)"
|
log_warn "Services PostgreSQL 恢复可能有警告(通常是正常的)"
|
||||||
|
|
@ -490,7 +490,7 @@ restore_selective() {
|
||||||
"services_postgres")
|
"services_postgres")
|
||||||
if docker ps --format '{{.Names}}' | grep -q "^${SERVICES_POSTGRES_CONTAINER}$"; then
|
if docker ps --format '{{.Names}}' | grep -q "^${SERVICES_POSTGRES_CONTAINER}$"; then
|
||||||
log_info "恢复 Services PostgreSQL..."
|
log_info "恢复 Services PostgreSQL..."
|
||||||
docker exec -i "$SERVICES_POSTGRES_CONTAINER" psql -U postgres < "$backup_dir/services_postgres_dump.sql" 2>/dev/null || true
|
docker exec -i "$SERVICES_POSTGRES_CONTAINER" psql -U rwa_user < "$backup_dir/services_postgres_dump.sql" 2>/dev/null || true
|
||||||
log_info "✓ Services PostgreSQL 恢复完成"
|
log_info "✓ Services PostgreSQL 恢复完成"
|
||||||
else
|
else
|
||||||
log_warn "容器未运行"
|
log_warn "容器未运行"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue