Re: [ADMIN] postgres pg_basebackup

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: [ADMIN] postgres pg_basebackup
Дата
Msg-id A737B7A37273E048B164557ADEF4A58B53A36F1F@ntex2010i.host.magwien.gv.at
обсуждение исходный текст
Ответ на Re: [ADMIN] postgres pg_basebackup  ("Brandl, Wolfgang" <wolfgang.brandl@brz.gv.at>)
Ответы Re: [ADMIN] postgres pg_basebackup  ("Brandl, Wolfgang" <wolfgang.brandl@brz.gv.at>)
AW: postgres pg_basebackup  ("Brandl, Wolfgang" <wolfgang.brandl@brz.gv.at>)
Список pgsql-admin
Wolfgang Brandl wrote:
> I restored the files into some new locations and made the symbolic links like:
> pgwb@BLIXSQL0:/data1/pgwb/pg_tblspc> ls -l
> total 0
> lrwxrwxrwx 1 pgwb users 24 May 10 15:42 16536 -> /data1/tablespaces/16536
> lrwxrwxrwx 1 pgwb users 24 May 10 15:43 16537 -> /data1/tablespaces/16537
> lrwxrwxrwx 1 pgwb users 24 May 10 15:43 16538 -> /data1/tablespaces/16538
> lrwxrwxrwx 1 pgwb users 24 May 10 15:43 16539 -> /data1/tablespaces/16539
> lrwxrwxrwx 1 pgwb users 24 May 10 15:43 16540 -> /data1/tablespaces/16540
> 
> After the start with:
> pg_ctl -D /data1/pgwb -l /logs1/logs/logfile start
> I got he following links in pg_tblspc:
> 
> pgwb@BLIXSQL0:/data1/pgwb> ls -xal pg_tblspc/
> total 8
> drwx------  2 pgwb users 4096 May 10 15:45 .
> drwx------ 19 pgwb pg    4096 May 10 15:45 ..
> lrwxrwxrwx  1 pgwb users   35 May 10 15:45 16536 -> /data1/tablespaces/TS_U_SPACE/tests
> lrwxrwxrwx  1 pgwb users   35 May 10 15:45 16537 -> /data1/tablespaces/TS_B_SPACE/tests
> lrwxrwxrwx  1 pgwb users   35 May 10 15:45 16538 -> /data1/tablespaces/TS_N_SPACE/tests
> lrwxrwxrwx  1 pgwb users   35 May 10 15:45 16539 -> /data1/tablespaces/TS_M_SPACE/tests
> lrwxrwxrwx  1 pgwb users   33 May 10 15:45 16540 -> /data1/tablespaces/metadata/tests
> 
> 
> where does postgress get the old container paths if they are not stored in the database?
> 
> Conclusion: I cannot start postgress and got he error in the log:
> LOG:  could not open tablespace directory "pg_tblspc/16537/PG_9.5_201510051": No such file
> or directory
> LOG:  could not open tablespace directory "pg_tblspc/16539/PG_9.5_201510051": No such file
> or directory
> LOG:  could not open tablespace directory "pg_tblspc/16538/PG_9.5_201510051": No such file
> or directory
> LOG:  could not open tablespace directory "pg_tblspc/16536/PG_9.5_201510051": No such file
> or directory
> LOG:  could not open tablespace directory "pg_tblspc/16540/PG_9.5_201510051": No such file
> or directory
> 
> For me it seems I have to note somewhere the whole linking information stored in pg_tblspc
> together with pg_basebackup.
> 
> I can use the olddir newdir options in pg_basebackup. But still I need this information
> outside of the backup package to restore the database after a crash to PIT.

You are right; after looking at the code, I realize that I got it wrong.

During an online backup, a file "tablespace_map" is created in the
data directory that contains the original locations of the tablespaces.

During recovery, the symbolic links are restored from that directory.

So you have to un-tar the tablespaces into the same location as in the
original database cluster.  The good news is that you can find the locations
in the "tablespace_map" file and don't need to document them somewhere.

Sorry for the misinformation in the original answer.

Yours,
Laurenz Albe

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

Предыдущее
От: "Brandl, Wolfgang"
Дата:
Сообщение: Re: [ADMIN] postgres pg_basebackup
Следующее
От: "Brandl, Wolfgang"
Дата:
Сообщение: Re: [ADMIN] postgres pg_basebackup