Thread: Upgrading error

Upgrading error

From
chris navarroza
Date:
Hi,

I have a postgresql server version 12.9 and trying to upgrade it to 14.5. My OS is Centos 8 Stream and I already managed to install postgresql14.5 but when I'm trying to upgrade, I am encountering this error

bash-4.4$ /usr/pgsql-14/bin/pg_upgrade --old-datadir=/home/dmartuser/pgdata/data/ --new-datadir=/home/dmartuser/pgdata/data/ --old-bindir=/usr/pgsql-12/bin/ --new-bindir=/usr/pgsql-14/bin/ --check --verbose
Running in verbose mode
Performing Consistency Checks
-----------------------------
Checking cluster versions
This utility can only upgrade to PostgreSQL version 14.
Failure, exiting

I can't seem to find any solution in the internet. Please help!

Sincerely,
butching


Re: Upgrading error

From
Tom Lane
Date:
chris navarroza <canavarroza.work@gmail.com> writes:
> bash-4.4$ /usr/pgsql-14/bin/pg_upgrade
> --old-datadir=/home/dmartuser/pgdata/data/
> --new-datadir=/home/dmartuser/pgdata/data/ --old-bindir=/usr/pgsql-12/bin/
> --new-bindir=/usr/pgsql-14/bin/ --check --verbose
> Running in verbose mode
> Performing Consistency Checks
> -----------------------------
> Checking cluster versions
> This utility can only upgrade to PostgreSQL version 14.

You cannot use the same directory as --old-datadir and --new-datadir.
I think pg_upgrade is unhappy because what it sees in PG_VERSION in
the --new-datadir isn't v14 ... but I wonder if we shouldn't be
checking for this mistake more directly.

Anyway, the right way to proceed is to use v14's initdb to create
a new directory at, say, /home/dmartuser/pgdata/data-14
and then pg_upgrade to that.  Afterwards you can rename the old
data directory out of the way and move the new one to
/home/dmartuser/pgdata/data, if you like.

            regards, tom lane



Re: Upgrading error

From
chris navarroza
Date:
Hi,

Thanks for the reply!

Sorry I missed that line, but now I'm having new error.

[root@datamartds tmp]# sudo su postgres
bash-4.4$ cd /tmp
bash-4.4$ /usr/pgsql-14/bin/pg_upgrade --old-datadir=/home/dmartuser/pgdata/data/ --new-datadir=/home/dmartuser/pgsql/14/data/ --old-bindir=/usr/pgsql-12/bin/ --new-bindir=/usr/pgsql-14/bin/ --old-options '-c config_file=/var/lib/pgsql/12/data/postgresql.conf' --new-options '-c config_file=/var/lib/pgsql/14/data/postgresql.conf' --check
Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok

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

connection to server on socket "/tmp/.s.PGSQL.50432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?

could not connect to source postmaster started with the command:
"/usr/pgsql-12/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "/home/dmartuser/pgdata/data" -o "-p 50432 -b -c config_file=/var/lib/pgsql/12/data/postgresql.conf -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directories='/tmp'" start
Failure, exiting



Thanks,

Chris Albert Navarroza
Information Technology Officer I
CTCO - ITDS - RDMD



On Fri, Oct 21, 2022 at 10:08 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
chris navarroza <canavarroza.work@gmail.com> writes:
> bash-4.4$ /usr/pgsql-14/bin/pg_upgrade
> --old-datadir=/home/dmartuser/pgdata/data/
> --new-datadir=/home/dmartuser/pgdata/data/ --old-bindir=/usr/pgsql-12/bin/
> --new-bindir=/usr/pgsql-14/bin/ --check --verbose
> Running in verbose mode
> Performing Consistency Checks
> -----------------------------
> Checking cluster versions
> This utility can only upgrade to PostgreSQL version 14.

You cannot use the same directory as --old-datadir and --new-datadir.
I think pg_upgrade is unhappy because what it sees in PG_VERSION in
the --new-datadir isn't v14 ... but I wonder if we shouldn't be
checking for this mistake more directly.

Anyway, the right way to proceed is to use v14's initdb to create
a new directory at, say, /home/dmartuser/pgdata/data-14
and then pg_upgrade to that.  Afterwards you can rename the old
data directory out of the way and move the new one to
/home/dmartuser/pgdata/data, if you like.

                        regards, tom lane

Re: Upgrading error

From
Tom Lane
Date:
chris navarroza <canavarroza.work@gmail.com> writes:
> could not connect to source postmaster started with the command:
> "/usr/pgsql-12/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D
> "/home/dmartuser/pgdata/data" -o "-p 50432 -b -c
> config_file=/var/lib/pgsql/12/data/postgresql.conf -c listen_addresses=''
> -c unix_socket_permissions=0700 -c unix_socket_directories='/tmp'" start
> Failure, exiting

Did you look into the postmaster log (pg_upgrade_server.log, here)
to see what it thought about the problem?  I'm guessing there's
something that kept it from starting, but there's no evidence
offered here about what.

            regards, tom lane



Re: Upgrading error

From
chris navarroza
Date:
This is the log I got.
-----------------------------------------------------------------
  pg_upgrade run on Mon Oct 24 07:41:13 2022
-----------------------------------------------------------------

command: "/usr/pgsql-12/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "/home/dmartuser/pgdata/data" -o "-p 50432 -b -c config_file=/var/lib/pgsql/12/data/postgresql.conf -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directories='/tmp'" start >> "pg_upgrade_server.log" 2>&1
waiting for server to start....2022-10-23 23:41:13.458 GMT [107444] LOG:  skipping missing configuration file "/home/dmartuser/pgdata/data/postgresql.auto.conf"
2022-10-24 07:41:13.459 PST [107444] LOG:  starting PostgreSQL 12.9 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4), 64-bit
2022-10-24 07:41:13.460 PST [107444] LOG:  listening on Unix socket "/tmp/.s.PGSQL.50432"
2022-10-24 07:41:13.486 PST [107444] LOG:  redirecting log output to logging collector process
2022-10-24 07:41:13.486 PST [107444] HINT:  Future log output will appear in directory "log".
 stopped waiting
pg_ctl: could not start server
Examine the log output.

Thanks,

Chris Albert Navarroza
Information Technology Officer I
CTCO - ITDS - RDMD



On Mon, Oct 24, 2022 at 8:12 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
chris navarroza <canavarroza.work@gmail.com> writes:
> could not connect to source postmaster started with the command:
> "/usr/pgsql-12/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D
> "/home/dmartuser/pgdata/data" -o "-p 50432 -b -c
> config_file=/var/lib/pgsql/12/data/postgresql.conf -c listen_addresses=''
> -c unix_socket_permissions=0700 -c unix_socket_directories='/tmp'" start
> Failure, exiting

Did you look into the postmaster log (pg_upgrade_server.log, here)
to see what it thought about the problem?  I'm guessing there's
something that kept it from starting, but there's no evidence
offered here about what.

                        regards, tom lane