Experience from the field: update from 4.1 to 4.2

I hope you are already aware of what´s new in CloudForms 4.2 you can read more in the official blog or even watch a great video about it.

The goal of this post is to provide field experience while updating from CloudForms 4.1 to CloudForms 4.2

A big change

In CloudForms 4.2 one of the biggest changes we had was moving from Postgres 9.4 to Postgres 9.5 and adding support for built-in HA. This change adds a new step to the update process: convert a non-HA DB into an HA-capable one.

Overview

We need to perform the following steps:

  • DB backup
  • Change the repos
  • Stop CloudForms
  • Update the appliance
  • Update the DB
  • Adapt the DB to Postgres 9.5
  • Start CloudForms

Procedure

We just need to follow the official doc but we need to make sure to follow exactly the procedure:

First, we make a backup (you know, just in case…)

pg_dump -Fc -U root vmdb_production > /tmp/[what_want_to_call_it].db

If you changed your iptables config, make sure you make a copy of the config since they are modified during the upgrade:

iptables-save > /etc/iptables.conf

Be aware of the note in the doc, this may impact you later:

For 5.6 appliances with the User Interface server role: Before migration, ensure that the Web Services role is enabled (it is enabled by default in CFME 5.6). If the Web Services role is disabled, it will not be turned on during the migration process. This role is required in CFME 5.7 to be able to log in to the user interface.

Remove the actual repos:
subscription-manager repos --disable=cf-me-5.6-for-rhel-7-rpms

Add the CloudForms 4.2 repos
subscription-manager repos --enable=cf-me-5.7-for-rhel-7-rpms --enable=rhel-server-rhscl-7-rpms --enable=rhel-7-server-rpms

Stop CloudForms services

systemctl stop evmserverd

  • If you are using replication (multi Region configurations) execute:

    vmdb bin/rake evm:dbsync:uninstall

Update the packages:

yum update

Make sure you log out and log in again to reload the proper ruby version

From the new shell go to the vmdb directory

vmdb

Perform the database migration:

bin/rake db:migrate

Now you need to execute the convert-to-ha script. It is mandatory to select "Y" (capital) when prompted for confirmation

/usr/bin/miq_postgres_upgrade.sh

Now, you need to edit the config file

vi /var/opt/rh/rh-postgresql95/lib/pgsql/data/postgresql.conf

Delete the following lines:

  checkpoint_segments = 15   # MIQ Value;
  #checkpoint_segments = 3    # in logfile segments, min 1, 16MB each
  shared_preload_libraries = 'pglogical'   # MIQ Value (change requires restart)

And make sure you add these:

  #max_wal_size = 1GB
  #min_wal_size = 80MB
  wal_log_hints = on
  shared_preload_libraries = 'pglogical,repmgr_funcs'   # MIQ Value (change requires restart)

Now, you have to enable the new Postgres 9.5 service

systemctl enable rh-postgresql95-postgresql && systemctl start rh-postgresql95-postgresql

Remember to restore you iptables config

iptables-restore < /etc/iptables.conf

And start CloudForms again:

systemctl start evmserverd