Question

PostgreSQL - Redirected restore - different instance name on target

  • 27 October 2022
  • 6 replies
  • 72 views

Badge +4

Hello Team,

 

Backup type: FSbased

Database version: 13.8 and 11.17

CV version: 11.26.36

 

Is it possible to perform a restoration of FSbased PostgreSQL backup (instance1) to a different server with different instance name (instance2) ? (where we have different instance name and OS linux users) 

 

  1. Will the copy operation from CV backup server to instance2 work?
  2. If it works, will it have file permissions same as instance1 ?

If not, then how do we handle this scenario. A typical example, we would like to copy a database from one instance to another. 

 

Regards,

Kamal


6 replies

Userlevel 5
Badge +13

Hi @Kamal Kumar 

I believe you have tablespaces inside your data directory. If my memory serves me right, we have an issue with redirected restore with this configuration. Could you please raise a support ticket with the failure you’re noticed? We can take a look.

The file permissions will be set according to the destination server Linux user.

 

Thanks,

Sunil

Badge +4

Hi Sunil,

At this moment, I don’t have tablespaces in the data directory. 

The file permissions will be set according to the destination server Linux user.

 

Correct my understanding if its wrong,

Let us assume, instance1 has these files in data directory, also OS user name: instance1 (where initdb initially ran) 

serverX:/srv/postgresql/data/instance1 # ls -ltrh

-rw------- 1 instance1 instance1 225 Oct 25 11:52 backup_label.old
drwx------ 2 instance1 instance1 6 Oct 25 11:52 pg_twophase
drwx------ 2 instance1 instance1 6 Oct 25 11:52 pg_snapshots

Now on target, OS user name: instance2 (where initdb initially ran) 

Based on your statement, the restore job will copy the data from CV backup server to target server and change the file permissions to instance2 as shown below, Is this the correct understanding?

serverX:/srv/postgresql/data/instance2 # ls -ltrh

-rw------- 1 instance2 instance2 225 Oct 25 11:52 backup_label.old
drwx------ 2 instance2 instance2 6 Oct 25 11:52 pg_twophase
drwx------ 2 instance2 instance2 6 Oct 25 11:52 pg_snapshots

Regards,

Kamal

Userlevel 5
Badge +13

Hi Sunil,

At this moment, I don’t have tablespaces in the data directory. 

The file permissions will be set according to the destination server Linux user.

 

Correct my understanding if its wrong,

Let us assume, instance1 has these files in data directory, also OS user name: instance1 (where initdb initially ran) 

serverX:/srv/postgresql/data/instance1 # ls -ltrh

-rw------- 1 instance1 instance1 225 Oct 25 11:52 backup_label.old
drwx------ 2 instance1 instance1 6 Oct 25 11:52 pg_twophase
drwx------ 2 instance1 instance1 6 Oct 25 11:52 pg_snapshots

Now on target, OS user name: instance2 (where initdb initially ran) 

Based on your statement, the restore job will copy the data from CV backup server to target server and change the file permissions to instance2 as shown below, Is this the correct understanding?

serverX:/srv/postgresql/data/instance2 # ls -ltrh

-rw------- 1 instance2 instance2 225 Oct 25 11:52 backup_label.old
drwx------ 2 instance2 instance2 6 Oct 25 11:52 pg_twophase
drwx------ 2 instance2 instance2 6 Oct 25 11:52 pg_snapshots

Regards,

Kamal

Yes Kamal.

Userlevel 7
Badge +23

@Kamal Kumar , can you let me know the case number once you have one opened?

Badge +4

@Mike Struening No case has been opened yet. 

Userlevel 7
Badge +23

Thanks for the update, @Kamal Kumar !

Let me know once you do, no rush.

Reply