Обсуждение: PgBackRest PITR restore

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

PgBackRest PITR restore

От
Gokan Atmaca
Дата:
Hello

Using PgBackRest I am able to restore the backup from 2 minutes ago.
Can I restore only one database?


Thanks.


-- 
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀⠀⠀⠀

Re: PgBackRest PITR restore

От
Victor Yegorov
Дата:
вт, 7 сент. 2021 г. в 13:32, Gokan Atmaca <linux.gokan@gmail.com>:
Using PgBackRest I am able to restore the backup from 2 minutes ago.
Can I restore only one database?
--
Victor Yegorov

Re: PgBackRest PITR restore

От
Frédéric Boulet
Дата:
Hello,

You can restore 1 database, but be careful, the other databases are also created but empty !

BR

Le mar. 7 sept. 2021 à 13:52, Victor Yegorov <vyegorov@gmail.com> a écrit :
вт, 7 сент. 2021 г. в 13:32, Gokan Atmaca <linux.gokan@gmail.com>:
Using PgBackRest I am able to restore the backup from 2 minutes ago.
Can I restore only one database?
--
Victor Yegorov

Re: PgBackRest PITR restore

От
Gokan Atmaca
Дата:
> https://pgbackrest.org/command.html#command-restore
>
> Look for --db-include

Very thanks, worked without a problem.


On Tue, Sep 7, 2021 at 2:52 PM Victor Yegorov <vyegorov@gmail.com> wrote:
>
> вт, 7 сент. 2021 г. в 13:32, Gokan Atmaca <linux.gokan@gmail.com>:
>>
>> Using PgBackRest I am able to restore the backup from 2 minutes ago.
>> Can I restore only one database?
>
>
> Yup.
>
> https://pgbackrest.org/command.html#command-restore
>
> Look for --db-include
>
>
> --
> Victor Yegorov



Re: PgBackRest PITR restore

От
Gokan Atmaca
Дата:
> Look for --db-include

This option restores a single database but corrupts the others. Is it
necessary to take a backup with "pg_dump" before doing this?


Other database error:
FATAL:  relation mapping file "base/16386/pg_filenode.map" contains invalid data


On Tue, Sep 7, 2021 at 2:52 PM Victor Yegorov <vyegorov@gmail.com> wrote:
>
> вт, 7 сент. 2021 г. в 13:32, Gokan Atmaca <linux.gokan@gmail.com>:
>>
>> Using PgBackRest I am able to restore the backup from 2 minutes ago.
>> Can I restore only one database?
>
>
> Yup.
>
> https://pgbackrest.org/command.html#command-restore
>
> Look for --db-include
>
>
> --
> Victor Yegorov



Re: PgBackRest PITR restore

От
Gokan Atmaca
Дата:
> You can restore 1 database, but be careful, the other databases are also created but empty !

you're right, now I get it. :)

On Tue, Sep 7, 2021 at 2:55 PM Frédéric Boulet <boulet.f@gmail.com> wrote:
>
> Hello,
>
> You can restore 1 database, but be careful, the other databases are also created but empty !
>
> BR
>
> Le mar. 7 sept. 2021 à 13:52, Victor Yegorov <vyegorov@gmail.com> a écrit :
>>
>> вт, 7 сент. 2021 г. в 13:32, Gokan Atmaca <linux.gokan@gmail.com>:
>>>
>>> Using PgBackRest I am able to restore the backup from 2 minutes ago.
>>> Can I restore only one database?
>>
>>
>> Yup.
>>
>> https://pgbackrest.org/command.html#command-restore
>>
>> Look for --db-include
>>
>>
>> --
>> Victor Yegorov



Re: PgBackRest PITR restore

От
Frédéric Boulet
Дата:
You need to restore the databases in a different directory, the "recover" the one you want.

Le mar. 7 sept. 2021 à 15:01, Gokan Atmaca <linux.gokan@gmail.com> a écrit :
> You can restore 1 database, but be careful, the other databases are also created but empty !

you're right, now I get it. :)

On Tue, Sep 7, 2021 at 2:55 PM Frédéric Boulet <boulet.f@gmail.com> wrote:
>
> Hello,
>
> You can restore 1 database, but be careful, the other databases are also created but empty !
>
> BR
>
> Le mar. 7 sept. 2021 à 13:52, Victor Yegorov <vyegorov@gmail.com> a écrit :
>>
>> вт, 7 сент. 2021 г. в 13:32, Gokan Atmaca <linux.gokan@gmail.com>:
>>>
>>> Using PgBackRest I am able to restore the backup from 2 minutes ago.
>>> Can I restore only one database?
>>
>>
>> Yup.
>>
>> https://pgbackrest.org/command.html#command-restore
>>
>> Look for --db-include
>>
>>
>> --
>> Victor Yegorov

Re: PgBackRest PITR restore

От
Gokan Atmaca
Дата:
> You need to restore the databases in a different directory, the "recover" the one you want.
When I do a PITR, the database is in recovery mode. (in archive recovery)
What do I need to do to get it back in "in production" mode?





On Tue, Sep 7, 2021 at 4:19 PM Frédéric Boulet <boulet.f@gmail.com> wrote:
>
> You need to restore the databases in a different directory, the "recover" the one you want.
>
> Le mar. 7 sept. 2021 à 15:01, Gokan Atmaca <linux.gokan@gmail.com> a écrit :
>>
>> > You can restore 1 database, but be careful, the other databases are also created but empty !
>>
>> you're right, now I get it. :)
>>
>> On Tue, Sep 7, 2021 at 2:55 PM Frédéric Boulet <boulet.f@gmail.com> wrote:
>> >
>> > Hello,
>> >
>> > You can restore 1 database, but be careful, the other databases are also created but empty !
>> >
>> > BR
>> >
>> > Le mar. 7 sept. 2021 à 13:52, Victor Yegorov <vyegorov@gmail.com> a écrit :
>> >>
>> >> вт, 7 сент. 2021 г. в 13:32, Gokan Atmaca <linux.gokan@gmail.com>:
>> >>>
>> >>> Using PgBackRest I am able to restore the backup from 2 minutes ago.
>> >>> Can I restore only one database?
>> >>
>> >>
>> >> Yup.
>> >>
>> >> https://pgbackrest.org/command.html#command-restore
>> >>
>> >> Look for --db-include
>> >>
>> >>
>> >> --
>> >> Victor Yegorov



Re: PgBackRest PITR restore

От
Gokan Atmaca
Дата:
> What do I need to do to get it back in "in production" mode?

I did as below. looks correct now. Is there any other method?

select pg_wal_replay_resume();
 pg_wal_replay_resume
----------------------

(1 row)

On Thu, Sep 9, 2021 at 5:29 PM Gokan Atmaca <linux.gokan@gmail.com> wrote:
>
> > You need to restore the databases in a different directory, the "recover" the one you want.
> When I do a PITR, the database is in recovery mode. (in archive recovery)
> What do I need to do to get it back in "in production" mode?
>
>
>
>
>
> On Tue, Sep 7, 2021 at 4:19 PM Frédéric Boulet <boulet.f@gmail.com> wrote:
> >
> > You need to restore the databases in a different directory, the "recover" the one you want.
> >
> > Le mar. 7 sept. 2021 à 15:01, Gokan Atmaca <linux.gokan@gmail.com> a écrit :
> >>
> >> > You can restore 1 database, but be careful, the other databases are also created but empty !
> >>
> >> you're right, now I get it. :)
> >>
> >> On Tue, Sep 7, 2021 at 2:55 PM Frédéric Boulet <boulet.f@gmail.com> wrote:
> >> >
> >> > Hello,
> >> >
> >> > You can restore 1 database, but be careful, the other databases are also created but empty !
> >> >
> >> > BR
> >> >
> >> > Le mar. 7 sept. 2021 à 13:52, Victor Yegorov <vyegorov@gmail.com> a écrit :
> >> >>
> >> >> вт, 7 сент. 2021 г. в 13:32, Gokan Atmaca <linux.gokan@gmail.com>:
> >> >>>
> >> >>> Using PgBackRest I am able to restore the backup from 2 minutes ago.
> >> >>> Can I restore only one database?
> >> >>
> >> >>
> >> >> Yup.
> >> >>
> >> >> https://pgbackrest.org/command.html#command-restore
> >> >>
> >> >> Look for --db-include
> >> >>
> >> >>
> >> >> --
> >> >> Victor Yegorov



Re: PgBackRest PITR restore

От
MichaelDBA
Дата:
  • “standby.signal” – indicates the server should start up as a hot standby
  • “recovery.signal” – indicates the server should start up in targeted recovery mode

Assuming we are at V12 or higher, simply remove standby.signal if exists in datadir and add the empty file recovery.signal in datadir.

Regards,
Michael Vitale


Gokan Atmaca wrote on 9/9/2021 10:29 AM:

You need to restore the databases in a different directory, the "recover" the one you want.
When I do a PITR, the database is in recovery mode. (in archive recovery)
What do I need to do to get it back in "in production" mode?





On Tue, Sep 7, 2021 at 4:19 PM Frédéric Boulet <boulet.f@gmail.com> wrote:
You need to restore the databases in a different directory, the "recover" the one you want.

Le mar. 7 sept. 2021 à 15:01, Gokan Atmaca <linux.gokan@gmail.com> a écrit :
You can restore 1 database, but be careful, the other databases are also created but empty !
you're right, now I get it. :)

On Tue, Sep 7, 2021 at 2:55 PM Frédéric Boulet <boulet.f@gmail.com> wrote:
Hello,

You can restore 1 database, but be careful, the other databases are also created but empty !

BR

Le mar. 7 sept. 2021 à 13:52, Victor Yegorov <vyegorov@gmail.com> a écrit :
вт, 7 сент. 2021 г. в 13:32, Gokan Atmaca <linux.gokan@gmail.com>:
Using PgBackRest I am able to restore the backup from 2 minutes ago.
Can I restore only one database?

Yup.

https://pgbackrest.org/command.html#command-restore

Look for --db-include


--
Victor Yegorov


Re: PgBackRest PITR restore

От
Gokan Atmaca
Дата:
> “standby.signal” – indicates the server should start up as a hot standby
> “recovery.signal” – indicates the server should start up in targeted recovery mode
>
> Assuming we are at V12 or higher, simply remove standby.signal if exists in datadir and add the empty file
recovery.signalin datadir. 

I'm sorry for the late reply. Thanks for information. I found the
following in your git repository.
I will try as soon as possible. Thanks for these apps. :)

https://github.com/MichaelDBA/pg_alert
https://github.com/MichaelDBA/pg_report

On Thu, Sep 9, 2021 at 5:38 PM MichaelDBA <MichaelDBA@sqlexec.com> wrote:
>
> “standby.signal” – indicates the server should start up as a hot standby
> “recovery.signal” – indicates the server should start up in targeted recovery mode
>
> Assuming we are at V12 or higher, simply remove standby.signal if exists in datadir and add the empty file
recovery.signalin datadir. 
>
> Regards,
> Michael Vitale
>
>
>
> Gokan Atmaca wrote on 9/9/2021 10:29 AM:
>
> You need to restore the databases in a different directory, the "recover" the one you want.
>
> When I do a PITR, the database is in recovery mode. (in archive recovery)
> What do I need to do to get it back in "in production" mode?
>
>
>
>
>
> On Tue, Sep 7, 2021 at 4:19 PM Frédéric Boulet <boulet.f@gmail.com> wrote:
>
> You need to restore the databases in a different directory, the "recover" the one you want.
>
> Le mar. 7 sept. 2021 à 15:01, Gokan Atmaca <linux.gokan@gmail.com> a écrit :
>
> You can restore 1 database, but be careful, the other databases are also created but empty !
>
> you're right, now I get it. :)
>
> On Tue, Sep 7, 2021 at 2:55 PM Frédéric Boulet <boulet.f@gmail.com> wrote:
>
> Hello,
>
> You can restore 1 database, but be careful, the other databases are also created but empty !
>
> BR
>
> Le mar. 7 sept. 2021 à 13:52, Victor Yegorov <vyegorov@gmail.com> a écrit :
>
> вт, 7 сент. 2021 г. в 13:32, Gokan Atmaca <linux.gokan@gmail.com>:
>
> Using PgBackRest I am able to restore the backup from 2 minutes ago.
> Can I restore only one database?
>
> Yup.
>
> https://pgbackrest.org/command.html#command-restore
>
> Look for --db-include
>
>
> --
> Victor Yegorov
>
>



Re: PgBackRest PITR restore

От
Stephen Frost
Дата:
Greetings,

* Gokan Atmaca (linux.gokan@gmail.com) wrote:
> > Look for --db-include
>
> This option restores a single database but corrupts the others. Is it
> necessary to take a backup with "pg_dump" before doing this?

"Corrupts" is only kind of correct- it explicitly doesn't restore the
other databases (since you asked for just one to be restored) and makes
it such that you're not able to log into them.

Performing an export with pg_dump is one approach to getting a point in
time view of all of the data in a given database, but you won't be able
to perform PITR-style restore with pg_dump's.

Thanks,

Stephen

Вложения