I have the database logs that I get through the pg_start_backup
and pg_stop_backup
commands. I would like to know how do I restore the bank through them?
Thank you!
I have the database logs that I get through the pg_start_backup
and pg_stop_backup
commands. I would like to know how do I restore the bank through them?
Thank you!
I understand that you have a PostgreSQL 9.4 running and want to restore the database from a backup done.
Just to remember that pg_start_backup
prevents writes from being written to the folder where the database is located, in order to maintain data consistency.
To perform a backup and restore it using pg_start_backup
, you need:
1 - Execute 'select pg_start_backup('label');'
2 - Execute o 'rsync' da sua pasta cluster (por padrão na versão 9.4 é a: '/var/lib/postgresql/9.4/main/' se não me engano)
3 - Execute 'select pg_stop_backup();'
4 - Copie todos os logs desde do inicio do 'pg_start_backup' até depois que voce tenha executado o 'pg_stop_backup'. Quando falo logs me refiro aos wal_files (Você pode checar aonde eles estão sendo armazenados através do 'archive_command' no seu 'postgresql.conf').
When you have done rsync
+ the copy of wal_files to the new server, you can already start Postgres.
Always remember to follow the logs for any errors.
EDIT: USING pg_basebackup
I always back up and restore my banks using pg_basebackup . In my opinion it is better and easier to use.