Thread: PgBackrest questions

PgBackrest questions

From
chiru r
Date:
Hi,

I am testing Pgbackrest and I have few questions.

please help if any one has tested these cases. 

1. I used postures user to perform backups and restores with Pgbackrest tool. 
The Trust authentication in pg_hba.conf file is working without issues.
 
If I use md5 authentication in pg_hba_conf file and postgres user password .pgpass file, the pgbackrest backup is failing.
Where should  i need to mention the password for postgres user in order to success the Pgbackrest backups?.

 
2.  All the restores through the backrest is going to refer the  Wal archive files under archive/<stanza name>/* directory, which are taken from pgbackrest?

3. What is the compression level by default in pgbackrest?
 
Thanks,
Chiranjeevi

Re: PgBackrest questions

From
Stephen Frost
Date:
Greetings,

* chiru r (chirupg@gmail.com) wrote:
> I am testing Pgbackrest and I have few questions.

Great!

> 1. I used postures user to perform backups and restores with Pgbackrest
> tool.
> The Trust authentication in pg_hba.conf file is working without issues.

Please don't use 'trust'.

> If I use md5 authentication in pg_hba_conf file and postgres user password
> .pgpass file, the pgbackrest backup is failing.

There really shouldn't ever be a need to use md5 authentication with
pgbackrest.  Instead, I'd strongly suggest you use 'peer'.  The 'peer'
method is perfectly safe as it depends on the authentication which
Unix provides, but it doesn't require a password or any of the
associated complications.  Note that 'trust' should *not* be used and
I'm glad to see that you're looking for alternatives to using 'trust'.

> 2.  All the restores through the backrest is going to refer the  Wal
> archive files under archive/<stanza name>/* directory, which are taken from
> pgbackrest?

When pgbackrest performs a restore, it will write out the recovery.conf
file for you which includes the restore command to pull the WAL from the
repo and stanza configured.  You shouldn't need to worry about where
those files are, specifically, coming from (and it's even possible that
it might change in the future...).  Is there a specific reason you're
asking?

> 3. What is the compression level by default in pgbackrest?

pgbackrest will use different compression levels depending on what
you're doing.  If your repo is compressed (the default), then zlib level
6 is used.  If you're storing your repo as uncompressed, then pgbackrest
will use level 3 compression for the network transfer.

Note that, in any case, pgbackrest only performs compression once- at
the source.  If the repo is compressed the the data is compressed to
level 6 at the source and then streamed directly out to disk in that
compressed form.  If the repo is uncompressed, then the data is
compressed to level 3 at the source and then decompressed before going
into the repo.

Thanks!

Stephen

Attachment

Re: PgBackrest questions

From
chiru r
Date:
Hi Stephen,

Thank you very much for your quick reply. 


On Wed, Mar 14, 2018 at 6:17 PM, Stephen Frost <sfrost@snowman.net> wrote:
Greetings,

* chiru r (chirupg@gmail.com) wrote:
> I am testing Pgbackrest and I have few questions.

Great!

> 1. I used postures user to perform backups and restores with Pgbackrest
> tool.
> The Trust authentication in pg_hba.conf file is working without issues.

Please don't use 'trust'.

> If I use md5 authentication in pg_hba_conf file and postgres user password
> .pgpass file, the pgbackrest backup is failing.

There really shouldn't ever be a need to use md5 authentication with
pgbackrest.  Instead, I'd strongly suggest you use 'peer'.  The 'peer'
method is perfectly safe as it depends on the authentication which
Unix provides, but it doesn't require a password or any of the
associated complications.  Note that 'trust' should *not* be used and
I'm glad to see that you're looking for alternatives to using 'trust'.

Is there any alternative method other than Peer and Trust  to use with pgbackrest tool?.
 
> 2.  All the restores through the backrest is going to refer the  Wal
> archive files under archive/<stanza name>/* directory, which are taken from
> pgbackrest?

When pgbackrest performs a restore, it will write out the recovery.conf
file for you which includes the restore command to pull the WAL from the
repo and stanza configured.  You shouldn't need to worry about where
those files are, specifically, coming from (and it's even possible that
it might change in the future...).  Is there a specific reason you're
asking?

I am concerned about WAL archives because, I am planning to transfer my backups to Tape as soon as pgbackrest completes backup on disk.
The restore of backups is going to be on different server.So i am concerned about recovery.

Ex: Always I restore my production backups on DEV environment.

And also I am planning to remove the Full,Diff and incremental backups on disk as soon as it transferred to tape. Is there any issue? since I am removing backups instead of Pg-backrest tool.
 
4. I observed that the backup.info and backup.info.copy files under stanza directory. I compared both files I did not see any difference.
    What is the reason to keep two files with same contents in same directory ?

5. The backup.manifest and backup.manifest.copy files exist under each backup directory(full/diff/incremental). What is the reason to keep to files in same directory?.
    What is the difference of backup.manifest file under backup.history directory and  under each backup directory?   
    
Thanks,
Chiranjeevi

Re: PgBackrest questions

From
chiru r
Date:
Greetings,

Please respond to my PgBackrest questions,if any one tested.

On Wed, Mar 14, 2018 at 10:54 PM, chiru r <chirupg@gmail.com> wrote:
Hi Stephen,

Thank you very much for your quick reply. 


On Wed, Mar 14, 2018 at 6:17 PM, Stephen Frost <sfrost@snowman.net> wrote:
Greetings,

* chiru r (chirupg@gmail.com) wrote:
> I am testing Pgbackrest and I have few questions.

Great!

> 1. I used postures user to perform backups and restores with Pgbackrest
> tool.
> The Trust authentication in pg_hba.conf file is working without issues.

Please don't use 'trust'.

> If I use md5 authentication in pg_hba_conf file and postgres user password
> .pgpass file, the pgbackrest backup is failing.

There really shouldn't ever be a need to use md5 authentication with
pgbackrest.  Instead, I'd strongly suggest you use 'peer'.  The 'peer'
method is perfectly safe as it depends on the authentication which
Unix provides, but it doesn't require a password or any of the
associated complications.  Note that 'trust' should *not* be used and
I'm glad to see that you're looking for alternatives to using 'trust'.

Is there any alternative method other than Peer and Trust  to use with pgbackrest tool?.
 
> 2.  All the restores through the backrest is going to refer the  Wal
> archive files under archive/<stanza name>/* directory, which are taken from
> pgbackrest?

When pgbackrest performs a restore, it will write out the recovery.conf
file for you which includes the restore command to pull the WAL from the
repo and stanza configured.  You shouldn't need to worry about where
those files are, specifically, coming from (and it's even possible that
it might change in the future...).  Is there a specific reason you're
asking?

I am concerned about WAL archives because, I am planning to transfer my backups to Tape as soon as pgbackrest completes backup on disk.
The restore of backups is going to be on different server.So i am concerned about recovery.

Ex: Always I restore my production backups on DEV environment.

And also I am planning to remove the Full,Diff and incremental backups on disk as soon as it transferred to tape. Is there any issue? since I am removing backups instead of Pg-backrest tool.
 
4. I observed that the backup.info and backup.info.copy files under stanza directory. I compared both files I did not see any difference.
    What is the reason to keep two files with same contents in same directory ?

5. The backup.manifest and backup.manifest.copy files exist under each backup directory(full/diff/incremental). What is the reason to keep to files in same directory?.
    What is the difference of backup.manifest file under backup.history directory and  under each backup directory?   
    
Thanks,
Chiranjeevi


Re: PgBackrest questions

From
Stephen Frost
Date:
Greetings,

* chiru r (chirupg@gmail.com) wrote:
> Please respond to my PgBackrest questions,if any one tested.

Please don't spam the lists repeatedly like this.  The responses to this
mailing list are provided by the community on a volunteer basis and
repeated emails are more likely to discourage responses than encourage
them.

Thanks!

Stephen

Attachment

Re: PgBackrest questions

From
Stephen Frost
Date:
Greetings,

* chiru r (chirupg@gmail.com) wrote:
> On Wed, Mar 14, 2018 at 6:17 PM, Stephen Frost <sfrost@snowman.net> wrote:
> > * chiru r (chirupg@gmail.com) wrote:
> > > I am testing Pgbackrest and I have few questions.
> >
> > Great!
> >
> > > 1. I used postures user to perform backups and restores with Pgbackrest
> > > tool.
> > > The Trust authentication in pg_hba.conf file is working without issues.
> >
> > Please don't use 'trust'.
> >
> > > If I use md5 authentication in pg_hba_conf file and postgres user
> > password
> > > .pgpass file, the pgbackrest backup is failing.
> >
> > There really shouldn't ever be a need to use md5 authentication with
> > pgbackrest.  Instead, I'd strongly suggest you use 'peer'.  The 'peer'
> > method is perfectly safe as it depends on the authentication which
> > Unix provides, but it doesn't require a password or any of the
> > associated complications.  Note that 'trust' should *not* be used and
> > I'm glad to see that you're looking for alternatives to using 'trust'.
>
> Is there any alternative method other than Peer and Trust  to use with
> pgbackrest tool?.

pgbackrest uses Perl's DBD::Pg to connect to PostgreSQL, which should
pick up on having a password provided through the environment variable
PGPASSWORD or that of DBI_PASS.  I would suggest setting one of those to
the password instead of trying to use .pgpass (though, given that
DBD::Pg uses libpq underneath, it's not clear to me off-hand why .pgpass
wouldn't work, but it's possible it doesn't because the username is
explicitly provided by pgbackrest to DBD::Pg's connect() routine).

> > > 2.  All the restores through the backrest is going to refer the  Wal
> > > archive files under archive/<stanza name>/* directory, which are taken
> > from
> > > pgbackrest?
> >
> > When pgbackrest performs a restore, it will write out the recovery.conf
> > file for you which includes the restore command to pull the WAL from the
> > repo and stanza configured.  You shouldn't need to worry about where
> > those files are, specifically, coming from (and it's even possible that
> > it might change in the future...).  Is there a specific reason you're
> > asking?
>
> I am concerned about WAL archives because, I am planning to transfer my
> backups to Tape as soon as pgbackrest completes backup on disk.
> The restore of backups is going to be on different server.So i am concerned
> about recovery.
>
> Ex: Always I restore my production backups on DEV environment.
>
> And also I am planning to *remove *the Full,Diff and incremental backups on
> disk as soon as it transferred to tape. Is there any issue? since I am
> removing backups instead of Pg-backrest tool.

I would strongly recommend against trying to expire out the backups
yourself as you have to take a great deal of caution when it comes to
expiring the WAL- if you expire the wrong WAL then your backups will no
longer be valid.  pgbackrest has expiration options and an expiration
process which runs automatically and which will take care of cleaning
out any WAL which is no longer useful.

We do have plans for improving the options around expiration.

pgbackrest does have an option called '--archive-copy' which will copy
the WAL files required to restore a given backup (and only that WAL)
into the backup directory.  If you use that option and disable
compression then the backup directory for a full backup can be copied
to a new location directly and started as a PG server, where it will
replay all of the WAL.  If you're using differentials or incrementals,
then you would also need to use the --repo-hardlink option (and be on a
filesystem which supports hard-links) to allow you to do the same with
those backups.

In general, this is all a great deal simpler by making the repository
available for doing restores instead of having to ship things between
repos in the way you're describing.  It's also possible to perform a
regular filesystem-level backup and restore of the repository itself and
use that directly instead of trying to extract things from the repo.

> 4. I observed that the *backup.info <http://backup.info>* and
> *backup.info.copy* files under stanza directory. I compared both files I
> did not see any difference.
>     What is the reason to keep two files with same contents in same
> directory ?

We don't want a crash or other issue to cause the backup.info file to be
only half-written, or similar, hence the reason for two copies.

> 5. The *backup.manifest *and *backup.manifest.copy* files exist under each
> backup directory(full/diff/incremental). What is the reason to keep to
> files in same directory?.

This is more-or-less the same reason as above.

>     What is the difference of backup.manifest file under *backup.history*
> directory and  under each backup directory?

The backup.history file simply contains historical information about
past backups, in the form of the manifest files.  Not much is done with
them currently but we envision having a way to get statistical
information about how the backups (and therefore, the database) have
changed in size over time and in how long they take to run and perhaps
other interesting metrics.

Thanks!

Stephen

Attachment