AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / server / Perguntas / 1163054
Accepted
QGuy
QGuy
Asked: 2024-07-25 20:49:21 +0800 CST2024-07-25 20:49:21 +0800 CST 2024-07-25 20:49:21 +0800 CST

Por que meu pg_basebackup é incompatível com Postgres?

  • 772

Eu tenho um script de shell de backup que executa o pg_basebackup todas as noites. Quando tento executá-lo, recebo esta mensagem de erro dizendo que pg_basebackup aparentemente não é compatível com Postgres.app versão 16.3.

2024-07-25 14:38:37 - Backup script started.
2024-07-25 14:38:37 - PG_USER: postgres
2024-07-25 14:38:37 - BACKUP_DIR: /Volumes/Atoma/Backup
2024-07-25 14:38:37 - TEMP_BACKUP_DIR: /Volumes/Atoma/tmp_backup
2024-07-25 14:38:37 - DAY_OF_WEEK: Donnerstag
2024-07-25 14:38:37 - BACKUP_NAME: Donnerstag.tar.gz
2024-07-25 14:38:37 - LOG_FILE: /Users/tristan/Server_Backup/daily.log
2024-07-25 14:38:37 - Starting backup for Donnerstag.
2024-07-25 14:38:37 - Running pg_basebackup command.
pg_basebackup: error: incompatible server version 16.3 (Postgres.app)
pg_basebackup: removing contents of data directory "/Volumes/Atoma/tmp_backup"
2024-07-25 14:38:38 - Backup failed for Donnerstag.
2024-07-25 14:38:38 - Backup script finished.

Eu uso o macOS Sonoma 14.5 (23F79). Este é o meu script de backup:

#!/bin/zsh


# Variables
PG_USER="xyz"
PG_USER_PW="xyz"
PORT="5432"
HOST="localhost"

BACKUP_DIR="/Volumes/Atoma/Backup"
TEMP_BACKUP_DIR="/Volumes/Atoma/tmp_backup"
DAY_OF_WEEK=$(date +%A)
BACKUP_NAME="$DAY_OF_WEEK.tar.gz"
LOG_FILE="/Users/tristan/Server_Backup/daily.log"

# create temporary directory (needed for pg_basebackup)
mkdir -p $TEMP_BACKUP_DIR

# log with timestamp
log_with_timestamp() {
  echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> $LOG_FILE
}

# Start logging
log_with_timestamp "Backup script started."

# Logging variables
log_with_timestamp "PG_USER: $PG_USER"
log_with_timestamp "BACKUP_DIR: $BACKUP_DIR"
log_with_timestamp "TEMP_BACKUP_DIR: $TEMP_BACKUP_DIR"
log_with_timestamp "DAY_OF_WEEK: $DAY_OF_WEEK"
log_with_timestamp "BACKUP_NAME: $BACKUP_NAME"
log_with_timestamp "LOG_FILE: $LOG_FILE"

# Start backup log process
log_with_timestamp "Starting backup for $DAY_OF_WEEK."

# Set the PGPASSWORD environment variable
export PGPASSWORD=$PG_USER_PW

# Run pg_basebackup
log_with_timestamp "Running pg_basebackup command."
if pg_basebackup -h $HOST -p $PORT -U $PG_USER -D $TEMP_BACKUP_DIR -Ft -z -P -Xs 2>> $LOG_FILE; then
    # Compress the backup and move it to the final destination
    mv $TEMP_BACKUP_DIR/$BACKUP_NAME $BACKUP_DIR
    log_with_timestamp "Backup completed successfully for $DAY_OF_WEEK."
else
    log_with_timestamp "Backup failed for $DAY_OF_WEEK."
fi

# Clean up temporary backup directory
rm -rf $TEMP_BACKUP_DIR

# Unset the PGPASSWORD environment variable for security
unset PGPASSWORD

# End of script
log_with_timestamp "Backup script finished."
backup
  • 1 1 respostas
  • 50 Views

1 respostas

  • Voted
  1. Best Answer
    QGuy
    2024-08-23T17:03:32+08:002024-08-23T17:03:32+08:00

    Eu tinha o PostgreSQL 14 e 15 instalado com o homebrew e meu script pegou o pg_basebackup da instalação do homebrew, que obviamente era a versão errada.

    Acabei de desinstalar a versão homebrew do Postgres brew uninstall postgresql@14e brew uninstall postgresql@15depois disso brew cleanup.

    Então adicionei a pasta bin em Postgres.app ao PATH export PATH=/Applications/Postgres.app/Contents/Versions/latest/bin:$PATHe coloquei-a no topo do meu script.

    • 0

relate perguntas

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Você pode passar usuário/passar para autenticação básica HTTP em parâmetros de URL?

    • 5 respostas
  • Marko Smith

    Ping uma porta específica

    • 18 respostas
  • Marko Smith

    Verifique se a porta está aberta ou fechada em um servidor Linux?

    • 7 respostas
  • Marko Smith

    Como automatizar o login SSH com senha?

    • 10 respostas
  • Marko Smith

    Como posso dizer ao Git para Windows onde encontrar minha chave RSA privada?

    • 30 respostas
  • Marko Smith

    Qual é o nome de usuário/senha de superusuário padrão para postgres após uma nova instalação?

    • 5 respostas
  • Marko Smith

    Qual porta o SFTP usa?

    • 6 respostas
  • Marko Smith

    Linha de comando para listar usuários em um grupo do Windows Active Directory?

    • 9 respostas
  • Marko Smith

    O que é um arquivo Pem e como ele difere de outros formatos de arquivo de chave gerada pelo OpenSSL?

    • 3 respostas
  • Marko Smith

    Como determinar se uma variável bash está vazia?

    • 15 respostas
  • Martin Hope
    Davie Ping uma porta específica 2009-10-09 01:57:50 +0800 CST
  • Martin Hope
    kernel O scp pode copiar diretórios recursivamente? 2011-04-29 20:24:45 +0800 CST
  • Martin Hope
    Robert ssh retorna "Proprietário incorreto ou permissões em ~/.ssh/config" 2011-03-30 10:15:48 +0800 CST
  • Martin Hope
    Eonil Como automatizar o login SSH com senha? 2011-03-02 03:07:12 +0800 CST
  • Martin Hope
    gunwin Como lidar com um servidor comprometido? 2011-01-03 13:31:27 +0800 CST
  • Martin Hope
    Tom Feiner Como posso classificar a saída du -h por tamanho 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich O que é um arquivo Pem e como ele difere de outros formatos de arquivo de chave gerada pelo OpenSSL? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent Como determinar se uma variável bash está vazia? 2009-05-13 09:54:48 +0800 CST

Hot tag

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve