Re: The backup API and general purpose backup software

Поиск
Список
Период
Сортировка
От Peter J. Holzer
Тема Re: The backup API and general purpose backup software
Дата
Msg-id 20200621154520.GC21591@hjp.at
обсуждение исходный текст
Ответ на Re: The backup API and general purpose backup software  (Ron <ronljohnsonjr@gmail.com>)
Ответы Re: The backup API and general purpose backup software  (Ron <ronljohnsonjr@gmail.com>)
Список pgsql-general
On 2020-06-21 10:32:16 -0500, Ron wrote:
> On 6/21/20 8:28 AM, Peter J. Holzer wrote:
> > To make a full backup with the "new" (non-exclusive) API, a software
> > must do the following
> >
> > 1. open a connection to the database
> >
> > 2. invoke pg_start_backup('label', false, false) in the connection from
> >     step 1.
> >
> > 3. copy the contents of the data directory to the backup medium
> >
> > 4. invoke pg_stop_backup(false, true) in the connection from step 1.
> >
> > 5. copy the result from the previous step to the backup medium.
>
> I don't understand that last step "5. copy the result from the previous step
> to the backup medium."  It seems to be a duplication of "3. copy the
> contents of the data directory to the backup medium".

Step three copies all the files from the data directory. However, there
is an additional piece of information you you need to recover the
database, and that is only returned by the call to pg_stop_backup:

postgres=# select * from pg_stop_backup(false, true);
╔═[ RECORD 1 ]═════════════════════════════════════════════════════════════════╗
║ lsn        │ A9/2F000130                                                     ║
║ labelfile  │ START WAL LOCATION: A9/2F000028 (file 00000001000000A90000002F)↵║
║            │ CHECKPOINT LOCATION: A9/2F000060                               ↵║
║            │ BACKUP METHOD: streamed                                        ↵║
║            │ BACKUP FROM: master                                            ↵║
║            │ START TIME: 2020-06-21 17:36:30 CEST                           ↵║
║            │ LABEL: backup # 1234                                           ↵║
║            │ START TIMELINE: 1                                              ↵║
║            │                                                                 ║
║ spcmapfile │ 17522 /home/postgres                                           ↵║
║            │                                                                 ║
╚════════════╧═════════════════════════════════════════════════════════════════╝

Without this information the backup is useless, so it must be backed
up, too. Obviously you can do that only after you got it.

        hp

--
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Ron
Дата:
Сообщение: Re: The backup API and general purpose backup software
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Unable to init and run postgresql-12 on centos 8.2.2004