Обсуждение: Pg_stop_backup process does not run - Backup Intervals

Поиск
Список
Период
Сортировка

Pg_stop_backup process does not run - Backup Intervals

От
Rodrigo Cavalcante
Дата:
Hi,

On alternate days my backup is failing, by the pg_stop_backup process ()
does not perform or quit.

Version PostgreSQL: 9.1.6

The following backup script:

PGDATA=/dados
SAVE_BASE_DIR=/backup/diario
backup="'bkpfull'"
data=$(date +'%d%m%y')

WAL_DIR=/backup/archive

mv $WAL_DIR/* $WAL_DIR/wal_anterior

psql -U postgres -h localhost -c 'select pg_start_backup('$backup',true);'
template1 && \

tar -czvf $SAVE_BASE_DIR/$data.tar.gz $PGDATA && psql -U postgres -h
localhost -c 'select pg_stop_backup();' template1



--
View this message in context:
http://postgresql.nabble.com/Pg-stop-backup-process-does-not-run-Backup-Intervals-tp5901538.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.



Re: Pg_stop_backup process does not run - Backup Intervals

От
Robert Haas
Дата:
On Mon, May 2, 2016 at 3:03 PM, Rodrigo Cavalcante
<rodrigo.java@gmail.com> wrote:
> On alternate days my backup is failing, by the pg_stop_backup process ()
> does not perform or quit.
>
> Version PostgreSQL: 9.1.6
>
> The following backup script:
>
> PGDATA=/dados
> SAVE_BASE_DIR=/backup/diario
> backup="'bkpfull'"
> data=$(date +'%d%m%y')
>
> WAL_DIR=/backup/archive
>
> mv $WAL_DIR/* $WAL_DIR/wal_anterior
>
> psql -U postgres -h localhost -c 'select pg_start_backup('$backup',true);'
> template1 && \
>
> tar -czvf $SAVE_BASE_DIR/$data.tar.gz $PGDATA && psql -U postgres -h
> localhost -c 'select pg_stop_backup();' template1

I'm going to refer you to
https://wiki.postgresql.org/wiki/Guide_to_reporting_problems

You aren't being very clear about what actually happens here, and you
haven't mentioned what showed up in the logs, either.  If I had to
guess, I'd guess that if you look at the output of this backup script
on alternate days, you'll find that some step in here is failing on
alternate days, with an error message to tell you which step is
failing and in what way.  That might help you figure out the problem.

Also, consider using one of the various backup toolkits that already
exist instead of writing your own script.  Also, consider using
pg_basebackup.  These tend to be more reliably than home-grown
scripts.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Re: Pg_stop_backup process does not run - Backup Intervals

От
Rodrigo Cavalcante
Дата:
Hello Robert,

Thanks for the feedback.

The my script works, but after a few days it stops working because the
process does not end pg_stop_backup.

The pg_basebackup already does this substitution?



--
View this message in context:
http://postgresql.nabble.com/Pg-stop-backup-process-does-not-run-Backup-Intervals-tp5901538p5901757.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.



Re: Pg_stop_backup process does not run - Backup Intervals

От
Robert Haas
Дата:
On Tue, May 3, 2016 at 4:21 PM, Rodrigo Cavalcante
<rodrigo.java@gmail.com> wrote:
> The my script works, but after a few days it stops working because the
> process does not end pg_stop_backup.

Well, that shouldn't happen, but without any logs or debugging
information, it's hard to guess why.

> The pg_basebackup already does this substitution?

If you use pg_basebackup, you don't need to run pg_start_backup() or
pg_stop_backup().

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Re: Pg_stop_backup process does not run - Backup Intervals

От
"David G. Johnston"
Дата:
On Mon, May 2, 2016 at 12:03 PM, Rodrigo Cavalcante <rodrigo.java@gmail.com> wrote:
Hi,

On alternate days my backup is failing, by the pg_stop_backup process ()
does not perform or quit.

Version PostgreSQL: 9.1.6

​Reporting unusual behavior while running a years-old point release is unlikely to be productive.  No one wants to debug something that very well may have been fixed in the meantime.

And, as Robert said, you need to provide considerably more detail than you have if you wish to get help diagnosing your situation.  And I too would recommend you not "roll your own" in this area unless you are trying to learn, at a lower-level, how these things work.

David J.

Re: Pg_stop_backup process does not run - Backup Intervals

От
Rodrigo Cavalcante
Дата:
Hi,

Thanks for the feedback.

Log:

LOG:  connection authorized: user=postgres database=template1
LOG:  statement: select pg_start_backup('bkpfull',true);
ERROR:  a backup is already in progress
HINT:  Run pg_stop_backup() and try again.
STATEMENT:  select pg_start_backup('bkpfull',true);
LOG:  disconnection: session time: 0:00:00.165 user=postgres
database=template1 host=localhost port=45746


I will use the pg_basebackup.





--
View this message in context:
http://postgresql.nabble.com/Pg-stop-backup-process-does-not-run-Backup-Intervals-tp5901538p5902082.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.