Обсуждение: Postgres upgrade from 9.4.9 to 9.6 using pg_upgrade error
Hi,
I am planning to upgrade our current Postgres 9.4.9 to 9.6 version using pg_upgrade method to reduce Production downtime. I followed below steps so far,
· Postgres 9.4.9 running on 5432 port.
· Same server, installed Postgres 9.6, its running fine on 5433 port.
· Stop both the Postgres services through pg_ctrlcluster method.
· Running below command to upgrade server.
o sudo -H -u postgres /usr/lib/postgresql/9.6/bin/pg_upgrade -b /usr/lib/postgresql/9.4/bin -B /usr/lib/postgresql/9.6/bin -d /var/lib/postgresql/9.4/main -D /var/lib/postgresql/9.6/main -o '-c config_file=/etc/postgresql/9.4/main/postgresql.conf' -o '-c config_file=/etc/postgresql/9.6/main/postgresql.conf'
·
· I am getting below error while executing above command:
command: "/usr/lib/postgresql/9.4/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "/var/lib/postgresql/9.4/main" -o "-p 50432 -b -c config_file=/etc/postgresql/9.4/main/postgresql.conf -c config_file=/etc/postgresql/9.6/main/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....2016-10-18 22:11:30 UTC [13107-1] FATAL: database files are incompatible with server
2016-10-18 22:11:30 UTC [13107-2] DETAIL: The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 9.4.9.
stopped waiting
pg_ctl: could not start server
Examine the log output.
Is it possible to upgrade Postgres 9.4.9 to 9.6 with pg_upgrade option or I need to do it through pg_dump only? Any help would be appreciated.
Thanks,
Ashish Chauhan
On Tue, Oct 18, 2016 at 10:15:47PM +0000, Ashish Chauhan wrote: > · I am getting below error while executing above command: > > command: "/usr/lib/postgresql/9.4/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D > "/var/lib/postgresql/9.4/main" -o "-p 50432 -b -c config_file=/etc/postgresql/ > 9.4/main/postgresql.conf -c config_file=/etc/postgresql/9.6/main/ > 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....2016-10-18 22:11:30 UTC [13107-1] FATAL: > database files are incompatible with server > > 2016-10-18 22:11:30 UTC [13107-2] DETAIL: The data directory was initialized > by PostgreSQL version 9.6, which is not compatible with this version 9.4.9. > > stopped waiting > > pg_ctl: could not start server > > Examine the log output. > > > > Is it possible to upgrade Postgres 9.4.9 to 9.6 with pg_upgrade option or I > need to do it through pg_dump only? Any help would be appreciated. It should work. I think you haven't follow the cluster initialization instructions properly and installed the wrong version somewhere. -- Bruce Momjian <bruce@momjian.us> http://momjian.us EnterpriseDB http://enterprisedb.com + As you are, so once was I. As I am, so you will be. + + Ancient Roman grave inscription +
2016-10-18 22:11:30 UTC [13107-1] FATAL: database files are incompatible with server
2016-10-18 22:11:30 UTC [13107-2] DETAIL: The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 9.4.9.
It seems the old-datadir /var/lib/postgresql/9.4/main is init by postgres version 9.6?