On Wed, Feb 08, 2017 at 09:00:35PM -0800, Jeremy Evans wrote:
> On 02/09 02:35, Stuart Henderson wrote:
> > I've just tried pg_upgrade following the pkg-readme. It went OK in the
> > end but there were some bumps along the way. A few notes:
> 
> Sorry about that.  The blame lies with me as I wrote the documentation.
> 
> How about the following patch, which I think addresses all of the issues
> you found?  To fix the data.old issue, let's version the old directory,
> since that makes data loss less likely.  We will need to remember to
> update the version when the PostgreSQL major version changes.
>

Yes, it's better.
ok pea@

> Thanks,
> Jeremy
> 
> Index: pkg/README-server
> ===================================================================
> RCS file: /cvs/ports/databases/postgresql/pkg/README-server,v
> retrieving revision 1.20
> diff -u -p -r1.20 README-server
> --- pkg/README-server 18 Dec 2016 18:18:27 -0000      1.20
> +++ pkg/README-server 9 Feb 2017 04:56:46 -0000
> @@ -125,7 +125,7 @@ to the current version.
>  # pkg_add -ui postgresql-server
>  
>  4) Backup your old data directory:
> -# mv /var/postgresql/data /var/postgresql/data.old
> +# mv /var/postgresql/data /var/postgresql/data-9.5
>  
>  5) Create a new data directory (using -E UTF8 if appropriate):
>  # su _postgresql -c "mkdir /var/postgresql/data"
> @@ -133,9 +133,9 @@ to the current version.
>  
>  6) Restore your old pg_hba.conf and (if used) SSL certificates
>  # su _postgresql -c \
> -    "cp /var/postgresql/data.old/pg_hba.conf /var/postgresql/data/"
> +    "cp /var/postgresql/data-9.5/pg_hba.conf /var/postgresql/data/"
>  # su _postgresql -c \
> -    "cp /var/postgresql/data.old/server.{crt,key} /var/postgresql/data/"
> +    "cp /var/postgresql/data-9.5/server.{crt,key} /var/postgresql/data/"
>  
>  Some postgresql.conf settings changed or disappeared in this version.
>  Examine your old file for local changes and apply them to the new version.
> @@ -157,10 +157,10 @@ faster than a dump and reload, especiall
>  # ${RCDIR}/postgresql stop
>  
>  2) Upgrade your PostgreSQL package with pkg_add.
> -# pkg_add -ui postgresql-pg_upgrade
> +# pkg_add postgresql-pg_upgrade
>  
>  3) Backup your old data directory:
> -# mv /var/postgresql/data /var/postgresql/data.old
> +# mv /var/postgresql/data /var/postgresql/data-9.5
>  
>  4) Create a new data directory (using -E UTF8 if appropriate):
>  # su _postgresql -c "mkdir /var/postgresql/data"
> @@ -168,19 +168,27 @@ faster than a dump and reload, especiall
>  
>  5) Restore your old pg_hba.conf and (if used) SSL certificates
>  # su _postgresql -c \
> -    "cp /var/postgresql/data.old/pg_hba.conf /var/postgresql/data/"
> +    "cp /var/postgresql/data-9.5/pg_hba.conf /var/postgresql/data/"
>  # su _postgresql -c \
> -    "cp /var/postgresql/data.old/server.{crt,key} /var/postgresql/data/"
> +    "cp /var/postgresql/data-9.5/server.{crt,key} /var/postgresql/data/"
>  
>  Some postgresql.conf settings changed or disappeared in this version.
>  Examine your old file for local changes and apply them to the new version.
>  
> -6) Run pg_upgrade:
> -# su _postgresql -c "pg_upgrade -b /usr/local/bin/postgresql-9.5/
> -                     -B /usr/local/bin -U postgres
> -                     -d /var/postgresql/data.old/ -D /var/postgresql/data"
> +6) Temporarily support connecting without a password for local users by
> +   editing pg_hba.conf to include "local all postgres trust"
> +# su _postgresql -c "vi /var/postgresql/data/pg_hba.conf"
> +
> +7) Run pg_upgrade:
> +# su _postgresql -c "cd /var/postgresql && \
> +                     pg_upgrade -b /usr/local/bin/postgresql-9.5/ \
> +                         -B /usr/local/bin -U postgres \
> +                         -d /var/postgresql/data-9.5/ -D 
> /var/postgresql/data"
>  
> -7) Start PostgreSQL:
> +8) Remove "local all postgres trust" line from pg_hba.conf
> +# su _postgresql -c "vi /var/postgresql/data/pg_hba.conf"
> +
> +9) Start PostgreSQL:
>  # ${RCDIR}/postgresql start
>  
>  Clients/Frontends
> 

Reply via email to