Обсуждение: error when upgrading 9.4 to 9.5 manually

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

error when upgrading 9.4 to 9.5 manually

От
arnaud gaboury
Дата:
My box upgraded postgresql from 9.4.8 to 9.5.3 when doing a full
version upgrade (Fedora 23 --> 24).

I have now :

/db/pgsal/data ----> initialized with 9.5, with postgresql.conf and
pg_hab.conf from 9.4
/db/pgsql/data.old ----> the old one from 9.4

/usr/lib64/pgsql/postgresql-9.4/bin which comes from
postgresql-upgrade Fedora package.
$ ls /usr/lib64/pgsql/postgresql-9.4/bin
drwxr-xr-x 1 root root   22 Jul  7 09:21 ../
-rwxr-xr-x 1 root root  28K May 12 15:34 pg_controldata*
-rwxr-xr-x 1 root root  41K May 12 15:34 pg_ctl*
-rwxr-xr-x 1 root root  29K May 12 15:34 pg_isready*
-rwxr-xr-x 1 root root  45K May 12 15:34 pg_receivexlog*
-rwxr-xr-x 1 root root  49K May 12 15:34 pg_recvlogical*
-rwxr-xr-x 1 root root  36K May 12 15:34 pg_resetxlog*
-rwxr-xr-x 1 root root 5.8M May 12 15:34 postgres*
lrwxrwxrwx 1 root root    8 May 12 15:33 postmaster -> postgres*

Now I think I shall run this command with postgres off
:

$ pg_upgrade -b /usr/lib64/pgsql/postgresql-9.4/bin -B /usr/bin -d
/db/pgsql/data.old -D /db/pgsql/data
But it reurns this error:

connection to database failed: could not connect to server: No such
file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/db/pgsql/.s.PGSQL.50432"?

could not connect to old postmaster started with the command:
"/usr/lib64/pgsql/postgresql-9.4/bin/pg_ctl" -w -l
"pg_upgrade_server.log" -D "/db/pgsql/data.old" -o "-p 50432 -b  -c
listen_addresses='' -c unix_socket_permissions=0700 -c
unix_socket_directories='/db/pgsql'" start
--------------------------------------

Posgresql is started with systemd service file and its socket is in
/run/postgresql

How can I start postgres with socket location in /db/pgsql ? There is
no option in pg_ctl to indicate socket directory.?

Thank you for help


--

google.com/+arnaudgabourygabx


Re: error when upgrading 9.4 to 9.5 manually

От
Tom Lane
Дата:
arnaud gaboury <arnaud.gaboury@gmail.com> writes:
> My box upgraded postgresql from 9.4.8 to 9.5.3 when doing a full
> version upgrade (Fedora 23 --> 24).

So I assume you're using the Fedora-supplied RPMs, not the PGDG ones?

(I'm not real sure, but I think the upgrade process would not have
chosen to replace non-Fedora RPMs.  If it did, that might be part of
your problem; I believe the Fedora packaging is still a bit different
directory-layout-wise from PGDG.  You'd be better off sticking with the
same PG package source.)

> Now I think I shall run this command with postgres off:
> $ pg_upgrade -b /usr/lib64/pgsql/postgresql-9.4/bin -B /usr/bin -d
> /db/pgsql/data.old -D /db/pgsql/data

Why are you not using "postgresql-setup upgrade", as documented in
/usr/share/doc/postgresql-NNN/README.rpm-dist ?

            regards, tom lane


Re: error when upgrading 9.4 to 9.5 manually

От
arnaud gaboury
Дата:
On Sun, Jul 10, 2016 at 5:36 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> arnaud gaboury <arnaud.gaboury@gmail.com> writes:
>> My box upgraded postgresql from 9.4.8 to 9.5.3 when doing a full
>> version upgrade (Fedora 23 --> 24).
>
> So I assume you're using the Fedora-supplied RPMs, not the PGDG ones?
>
> (I'm not real sure, but I think the upgrade process would not have
> chosen to replace non-Fedora RPMs.  If it did, that might be part of
> your problem; I believe the Fedora packaging is still a bit different
> directory-layout-wise from PGDG.  You'd be better off sticking with the
> same PG package source.)
>
>> Now I think I shall run this command with postgres off:
>> $ pg_upgrade -b /usr/lib64/pgsql/postgresql-9.4/bin -B /usr/bin -d
>> /db/pgsql/data.old -D /db/pgsql/data
>
> Why are you not using "postgresql-setup upgrade", as documented in
> /usr/share/doc/postgresql-NNN/README.rpm-dist ?

Ok. With the data from my 9-4, i.e /db/pgsql/data, and with
postgresql.service stopped.
 # postgresql-setup --upgrade
 * Upgrading database.
ERROR: pg_upgrade tool failed
ERROR: Upgrade failed.
 * See /var/lib/pgsql/upgrade_postgresql.log for details.

# cat /var/lib/pgsql/upgrade_postgresql.log

*failure*
Consult the last few lines of "pg_upgrade_server.log" for
the probable cause of the failure.

connection to database failed: could not connect to server: No such
file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/home/postgres/.s.PGSQL.5432"?

could not connect to old postmaster started with the command:
"/usr/lib64/pgsql/postgresql-9.4/bin/pg_ctl" -w -l
"pg_upgrade_server.log" -D "/db/pgsql/data-old" -o "-p 5432 -b  -c
listen_addresses='' -c unix_socket_permissions=0700 -c
unix_socket_directories='/home/postgres'" start


As you can see, postgres can't find the socket

>
>                         regards, tom lane



--

google.com/+arnaudgabourygabx


Re: error when upgrading 9.4 to 9.5 manually

От
Tom Lane
Дата:
arnaud gaboury <arnaud.gaboury@gmail.com> writes:
> Ok. With the data from my 9-4, i.e /db/pgsql/data, and with
> postgresql.service stopped.
>  # postgresql-setup --upgrade
>  * Upgrading database.
> ERROR: pg_upgrade tool failed
> ERROR: Upgrade failed.
>  * See /var/lib/pgsql/upgrade_postgresql.log for details.

> # cat /var/lib/pgsql/upgrade_postgresql.log

> *failure*
> Consult the last few lines of "pg_upgrade_server.log" for
> the probable cause of the failure.

> connection to database failed: could not connect to server: No such
> file or directory
>     Is the server running locally and accepting
>     connections on Unix domain socket "/home/postgres/.s.PGSQL.5432"?

> could not connect to old postmaster started with the command:
> "/usr/lib64/pgsql/postgresql-9.4/bin/pg_ctl" -w -l
> "pg_upgrade_server.log" -D "/db/pgsql/data-old" -o "-p 5432 -b  -c
> listen_addresses='' -c unix_socket_permissions=0700 -c
> unix_socket_directories='/home/postgres'" start

> As you can see, postgres can't find the socket

You're jumping to a conclusion not supported by this evidence;
we can't tell whether the postmaster started at all.  Did you
look into pg_upgrade_server.log as suggested?

            regards, tom lane


Re: error when upgrading 9.4 to 9.5 manually

От
Adrian Klaver
Дата:
On 07/10/2016 03:13 AM, arnaud gaboury wrote:
> My box upgraded postgresql from 9.4.8 to 9.5.3 when doing a full
> version upgrade (Fedora 23 --> 24).
>
> I have now :
>
> /db/pgsal/data ----> initialized with 9.5, with postgresql.conf and
> pg_hab.conf from 9.4
> /db/pgsql/data.old ----> the old one from 9.4

Which is the opposite of what you said here:

https://www.postgresql.org/message-id/CAK1hC9t6h9CENXQ6FHchx1Ny1AAAuYf2ARTpeospz1Jd7q_qLg%40mail.gmail.com


> How can I start postgres with socket location in /db/pgsql ? There is
> no option in pg_ctl to indicate socket directory.?
>
> Thank you for help

At this point I think your best option is to start over, if that is
possible. By this I mean:

1) See if it is possible to get a Fedora 24 package from Fedora for
Postgres 9.4.

2) If it is make sure you have the existing 9.4 cluster saved somewhere
out of the way.

3) Uninstall Postgres 9.5

4) Install Postgres 9.4 and copy the cluster you saved 2) into the data
directory.

5) Decide whether you want to stay with 9.4 or move up to 9.5.

6) If you do decide to move up take a pg_dump of the 9.4 data before you
do anything.

>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: error when upgrading 9.4 to 9.5 manually

От
arnaud gaboury
Дата:
On Sun, Jul 10, 2016 at 7:07 PM, Adrian Klaver
<adrian.klaver@aklaver.com> wrote:
> On 07/10/2016 03:13 AM, arnaud gaboury wrote:
>>
>> My box upgraded postgresql from 9.4.8 to 9.5.3 when doing a full
>> version upgrade (Fedora 23 --> 24).
>>
>> I have now :
>>
>> /db/pgsal/data ----> initialized with 9.5, with postgresql.conf and
>> pg_hab.conf from 9.4
>> /db/pgsql/data.old ----> the old one from 9.4
>
>
> Which is the opposite of what you said here:
>
> https://www.postgresql.org/message-id/CAK1hC9t6h9CENXQ6FHchx1Ny1AAAuYf2ARTpeospz1Jd7q_qLg%40mail.gmail.com
>
>
>> How can I start postgres with socket location in /db/pgsql ? There is
>> no option in pg_ctl to indicate socket directory.?
>>
>> Thank you for help
>
>
> At this point I think your best option is to start over, if that is
> possible. By this I mean:
>
> 1) See if it is possible to get a Fedora 24 package from Fedora for Postgres
> 9.4.
>
> 2) If it is make sure you have the existing 9.4 cluster saved somewhere out
> of the way.
>
> 3) Uninstall Postgres 9.5
>
> 4) Install Postgres 9.4 and copy the cluster you saved 2) into the data
> directory.
>
> 5) Decide whether you want to stay with 9.4 or move up to 9.5.
>
> 6) If you do decide to move up take a pg_dump of the 9.4 data before you do
> anything.
>
>>
I already wasted too much time on this issue. I had one back up of my
/db/pgsql/data folder. I know this folder is clean and was the one I
used with 9.4. Now, using this folder, none of the described methods
work.
I decided to initialize a new DB and create again the database, as
this one was luckily small.
Now everything is OK and I will act differently on the next major
version upgrade.

Thank you for your patience.


Re: error when upgrading 9.4 to 9.5 manually

От
Adrian Klaver
Дата:
On 07/11/2016 01:00 AM, arnaud gaboury wrote:
> On Sun, Jul 10, 2016 at 7:07 PM, Adrian Klaver
> <adrian.klaver@aklaver.com> wrote:
>> On 07/10/2016 03:13 AM, arnaud gaboury wrote:
>>>
>>> My box upgraded postgresql from 9.4.8 to 9.5.3 when doing a full
>>> version upgrade (Fedora 23 --> 24).
>>>
>>> I have now :
>>>
>>> /db/pgsal/data ----> initialized with 9.5, with postgresql.conf and
>>> pg_hab.conf from 9.4
>>> /db/pgsql/data.old ----> the old one from 9.4
>>
>>
>> Which is the opposite of what you said here:
>>
>> https://www.postgresql.org/message-id/CAK1hC9t6h9CENXQ6FHchx1Ny1AAAuYf2ARTpeospz1Jd7q_qLg%40mail.gmail.com
>>
>>
>>> How can I start postgres with socket location in /db/pgsql ? There is
>>> no option in pg_ctl to indicate socket directory.?
>>>
>>> Thank you for help
>>
>>
>> At this point I think your best option is to start over, if that is
>> possible. By this I mean:
>>
>> 1) See if it is possible to get a Fedora 24 package from Fedora for Postgres
>> 9.4.
>>
>> 2) If it is make sure you have the existing 9.4 cluster saved somewhere out
>> of the way.
>>
>> 3) Uninstall Postgres 9.5
>>
>> 4) Install Postgres 9.4 and copy the cluster you saved 2) into the data
>> directory.
>>
>> 5) Decide whether you want to stay with 9.4 or move up to 9.5.
>>
>> 6) If you do decide to move up take a pg_dump of the 9.4 data before you do
>> anything.
>>
>>>
> I already wasted too much time on this issue. I had one back up of my
> /db/pgsql/data folder. I know this folder is clean and was the one I
> used with 9.4. Now, using this folder, none of the described methods
> work.
> I decided to initialize a new DB and create again the database, as
> this one was luckily small.
> Now everything is OK and I will act differently on the next major
> version upgrade.

To make things easier and to echo Kris Deugau's suggestion I would use
the community repos:

https://www.postgresql.org/download/linux/redhat/#yum

>
> Thank you for your patience.
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com