Обсуждение: pg_upgrade question

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

pg_upgrade question

От
"Lu, Dan"
Дата:

Hi PostgreSQL Admin,

 

I am trying to find out if there is any step by step instruction to reconcile old data dir and upgraded data dir after using “—link” option to do an upgrade.

 

I ran this to do an upgrade from 11.5 to 12.1: pg_upgrade -d /hostname/pg/dev115/data -D /hostname/pg/dev121upg/data --link -b /pgdbadevbal800/pg/PostgreSQL-11.5/bin -B /pgdbadevbal800/pg/PostgreSQL-12.1/bin -p 1432 -P 2432 –v

 

postgresdbad:dev115:pgdbadevbal800:> pwd

/hostname/pg

 

postgresdbad:dev115:pgdbadevbal800:> du -sh dev121upg

2.3G    dev121upg

 

postgresdbad:dev115:pgdbadevbal800:> du -sh dev115

22G     dev115

 

My goal is to be able to do an in place upgrade from 11.5 to 12.1 using the same data dir “/hostname/pg/dev115/data”.  Without the “—link” option I need to double up the space usage for the instance.  What is the easiest way to accomplish this task?

 

Thanks so much for your help.


Dan




IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.

Re: pg_upgrade question

От
Paul Förster
Дата:
Hi Dan,

> I am trying to find out if there is any step by step instruction to reconcile old data dir and upgraded data dir
afterusing “—link” option to do an upgrade. 
>
> I ran this to do an upgrade from 11.5 to 12.1: pg_upgrade -d /hostname/pg/dev115/data -D /hostname/pg/dev121upg/data
--link-b /pgdbadevbal800/pg/PostgreSQL-11.5/bin -B /pgdbadevbal800/pg/PostgreSQL-12.1/bin -p 1432 -P 2432 –v 
>
> postgresdbad:dev115:pgdbadevbal800:> pwd
> /hostname/pg
>
> postgresdbad:dev115:pgdbadevbal800:> du -sh dev121upg
> 2.3G    dev121upg
>
> postgresdbad:dev115:pgdbadevbal800:> du -sh dev115
> 22G     dev115
>
> My goal is to be able to do an in place upgrade from 11.5 to 12.1 using the same data dir “/hostname/pg/dev115/data”.
Without the “—link” option I need to double up the space usage for the instance.  What is the easiest way to accomplish
thistask? 
>
> Thanks so much for your help.

after a successful upgrade, you may delete the dev115 directory and move the dev121upg directory in its place. That's
howI usually do it. Something like this example: 

(DB = cluster name)

/data/pg/DB/db     <= PGDATA old
/data/pg/DB/dbnew  <= PGDATA new, do the initdb here!

initdb -k -D /data/pg/DB/dbnew ...
pg_upgrade -d /data/pg/DB/db -D /data/pg/DB/dbnew ...
pg_ctl -D /data/pg/DB/dbnew stop
rm -rf /data/pg/DB/db
mv /data/pg/DB/dbnew /data/pg/DB/db
pg_ctl -D /data/pg/DB/db start

Your milage may vary. Use at your own risk. ;-)

If you shut down a PostgreSQL cluster properly, you can then easily move PGDATA to virtually any place you want and
startit there because PostgreSQL doesn't keep references to absolute paths anywhere. 

Cheers,
Paul