How to restore the table space tar files created by pg_basebackup?

Started by Sambaover 14 years ago4 messagesgeneral
Jump to latest
#1Samba
saasira@gmail.com

Hi all,

I have taken a base backup of my master server using pg_basebackup command
as below:
pg_basebackup -D /tmp/PostgresBackup/ -Ft -Z 9 -l masterbackup -h
localhost -U replication -w

The above created 4 tar files, namely: 16394.tar.gz 16395.tar.gz
16396.tar.gz base.tar.gz

I do know that my database contains 3 table spaces in addition to
pg_default and pg_global ( I guess, that is why it created those three
numbered tar.gz files, plus one base.tar.gz file ) and my master and
standby servers are identical by all means.

Now, I'm not sure how can I restore these files on the standby server. I
could restore the base.tar.gz into the data directory on standby and the
streaming replication has started working properly. But I'm not sure what
to do with these additional numbered gz files which contains the same data
that is already contained in the base.tar.gz file.

Can some one explain me what to do with these files? The documentation for
pg_basebackup does not mention this information, it just says that a
different variant of the command will fail if there are multiple table
spaces.

Another related query is if we can specify the name of the backup file
instead of leaving it to be base.tar.gz file.

Thanks and Regards,
Samba

#2Venkat Balaji
venkat.balaji@verse.in
In reply to: Samba (#1)
Re: How to restore the table space tar files created by pg_basebackup?

Do you have Tablespace directories with a softlink to the data directory ?

Thanks
VB

On Wed, Nov 30, 2011 at 7:42 PM, Samba <saasira@gmail.com> wrote:

Show quoted text

Hi all,

I have taken a base backup of my master server using pg_basebackup command
as below:
pg_basebackup -D /tmp/PostgresBackup/ -Ft -Z 9 -l masterbackup -h
localhost -U replication -w

The above created 4 tar files, namely: 16394.tar.gz 16395.tar.gz
16396.tar.gz base.tar.gz

I do know that my database contains 3 table spaces in addition to
pg_default and pg_global ( I guess, that is why it created those three
numbered tar.gz files, plus one base.tar.gz file ) and my master and
standby servers are identical by all means.

Now, I'm not sure how can I restore these files on the standby server. I
could restore the base.tar.gz into the data directory on standby and the
streaming replication has started working properly. But I'm not sure what
to do with these additional numbered gz files which contains the same data
that is already contained in the base.tar.gz file.

Can some one explain me what to do with these files? The documentation for
pg_basebackup does not mention this information, it just says that a
different variant of the command will fail if there are multiple table
spaces.

Another related query is if we can specify the name of the backup file
instead of leaving it to be base.tar.gz file.

Thanks and Regards,
Samba

#3Samba
saasira@gmail.com
In reply to: Venkat Balaji (#2)
Re: How to restore the table space tar files created by pg_basebackup?

Hi Venkat,
I verified that the tablespaces are located in actual directories and not
any symbolic links. Another interesting thing is that the content in these
additional tar.gz files is already present in the base.tar.gz file.

Regards,
Samba

------------------------------------------------------------------------------------------------------------------------------
On Thu, Dec 1, 2011 at 11:29 AM, Venkat Balaji <venkat.balaji@verse.in>wrote:

Show quoted text

Do you have Tablespace directories with a softlink to the data directory ?

Thanks
VB

On Wed, Nov 30, 2011 at 7:42 PM, Samba <saasira@gmail.com> wrote:

Hi all,

I have taken a base backup of my master server using pg_basebackup
command as below:
pg_basebackup -D /tmp/PostgresBackup/ -Ft -Z 9 -l masterbackup -h
localhost -U replication -w

The above created 4 tar files, namely: 16394.tar.gz 16395.tar.gz
16396.tar.gz base.tar.gz

I do know that my database contains 3 table spaces in addition to
pg_default and pg_global ( I guess, that is why it created those three
numbered tar.gz files, plus one base.tar.gz file ) and my master and
standby servers are identical by all means.

Now, I'm not sure how can I restore these files on the standby server. I
could restore the base.tar.gz into the data directory on standby and the
streaming replication has started working properly. But I'm not sure what
to do with these additional numbered gz files which contains the same data
that is already contained in the base.tar.gz file.

Can some one explain me what to do with these files? The documentation
for pg_basebackup does not mention this information, it just says that a
different variant of the command will fail if there are multiple table
spaces.

Another related query is if we can specify the name of the backup file
instead of leaving it to be base.tar.gz file.

Thanks and Regards,
Samba

#4Magnus Hagander
magnus@hagander.net
In reply to: Samba (#3)
Re: How to restore the table space tar files created by pg_basebackup?

It will be that if you have the tablespaces in the actual directories.
The question is how and why you ended up with the tablespaces in the
actual directories there, and not symlinks. It seems rather pointless
to have tablespaces if they go in there...

//Magnus

Show quoted text

On Thu, Dec 1, 2011 at 13:35, Samba <saasira@gmail.com> wrote:

Hi Venkat,
I verified that the tablespaces are located in actual directories and not
any symbolic links. Another interesting thing is that the content in these
additional tar.gz files is already present in the base.tar.gz file.

Regards,
Samba

------------------------------------------------------------------------------------------------------------------------------
On Thu, Dec 1, 2011 at 11:29 AM, Venkat Balaji <venkat.balaji@verse.in>
wrote:

Do you have Tablespace directories with a softlink to the data directory ?
Thanks
VB
On Wed, Nov 30, 2011 at 7:42 PM, Samba <saasira@gmail.com> wrote:

Hi all,

I have taken a base backup of my master server using pg_basebackup
command as below:
pg_basebackup -D /tmp/PostgresBackup/ -Ft -Z 9 -l masterbackup -h
localhost -U replication -w

The above created 4 tar files, namely: 16394.tar.gz  16395.tar.gz
 16396.tar.gz  base.tar.gz

I do know that my database contains 3 table spaces in addition to
pg_default and pg_global ( I guess, that is why it created those three
numbered tar.gz files, plus one base.tar.gz file ) and my master and standby
servers are identical by all means.

Now, I'm not sure how can I restore these files on the standby server. I
could restore the base.tar.gz into the data directory on standby and the
streaming replication has started working properly. But I'm not sure what to
do with these additional numbered gz files which contains the same data that
is already contained in the base.tar.gz file.

Can some one explain me what to do with these files? The documentation
for pg_basebackup does not mention this information, it just says that a
different variant of the command will fail if there are multiple table
spaces.

Another related query is if  we can specify the name of the backup file
instead of leaving it to be base.tar.gz file.

Thanks and Regards,
Samba