Update postgres version from 9.5 to 10 of external database

Hey there,

I want to update my manageiq appliance from hammer to ivanchuk. So I installed a new appliance with the ivanchuk image. Now I am trying to connect the new appliance to my existing external database where hammer with postgres version 9.5 is running.
The evm.log file shows an error message that says

The version of PostgreSQL being connected to is incompatible with ManageIQ (10 required) (RuntimeError)

How can I update the postgres version of my existing database instance?


Hi Moritz,
I have the same issue from hammer-8 to ivanchuk-1.I can’t import the dump from hammer-8; here are the commands I used:

ruby /usr/local/bin/rake evm:db:backup:local – --local-file /var/opt/rh/evm_db.backup

ruby /usr/local/bin/rake evm:db:restore:local --trace – --local-file /var/opt/evm_db.backup

I installed postgresql 9.6:

yum install https://yum.postgresql.org/9.6/redhat/rhel-7.3-x86_64/pgdg-redhat96-9.6-3.noarch.rpm
yum install postgresql96-server postgresql96-contrib
/usr/pgsql-9.6/bin/postgresql96-setup initdb

I exported the db from hammer-8 and I imported on ivanchuk-1 with postgresql 9.6

I converted data with pg_upgrade:

dropdb vmdb_production
dropuser root
pg_upgrade --check --old-datadir=/var/lib/pgsql/9.6/data --new-datadir=/var/lib/pgsql/data --old-bindir=/usr/pgsql-9.6/bin --new-bindir=/usr/bin/
pg_upgrade --link --old-datadir=/var/lib/pgsql/9.6/data --new-datadir=/var/lib/pgsql/data --old-bindir=/usr/pgsql-9.6/bin --new-bindir=/usr/bin/

I still have an error in /var/log/manageiq/evm.log:

/var/www/miq/vmdb/config/initializers/postgres_required_versions.rb:15:in `check_version’: The version of PostgreSQL being connected to is incompatible with ManageIQ (10 required) (RuntimeError)

I’m running a bit ouf idea there.
I will try replication with slony.

This is a good general upgrade pattern for upgrading postgres: https://stackoverflow.com/a/34439461

Also see this document: https://www.postgresql.org/docs/10/upgrading.html

I have it working with:

on previous db server:
pg_dump vmdb_production > dbname.bak
scp dbname.bak ivanchukserver://var/www/log/

on ivanchuk server:
appliance_console_cli --internal --dbdisk /dev/sdb --region 0 --password mypassword
systemctl stop evmserverd
su - postgres
dropdb vmdb_production
createdb vmdb_production -O root
psql vmdb_production < /var/www/log/dbname.bak
bin/rake db:migrate
rake evm:automate:reset