This document describes system upgrade process from previous Mentat production
versions within the
2.x series. For upgrading from
series please see the Migration section.
Prerequisite for upgrading is an existing and working installation of all Mentat system packages.
Upgrading Mentat system¶
After each upgrade of the Mentat system package please execute following commands to make sure everything is in working order:
# Step 1: Make sure to install all new prerequisites, for example with ``pip``: pip3 install -r /etc/mentat/requirements.pip # Step 2: Make sure database schema is up to date: mentat-dbmngr.py --command init # Step 3: Perform all required database schema migrations: /etc/mentat/scripts/sqldb-migrate.py db upgrade --directory /etc/mentat/migrations
Upgrading PostgreSQL from 10.x to 11.x¶
Following checklist describes the steps necessary to upgrade the PostgreSQL database
11.x. Please be aware, that the database upgrade is
not a straightforward operation. It can take a lot of time depending on the size
of the current database, because the data files need to be converted to new format.
# Stop all processes touching the PostgreSQL database: systemctl stop apache2 mentat-controller.py --command stop mentat-controller.py --command disable systemctl stop postgresql # Install PostgreSQL 11 & friends: apt-get update apt-get install postgresql-11 postgresql-11-ip4r postgresql-server-dev-11 # Verify the installation success (output included): pg_lsclusters :Ver Cluster Port Status Owner Data directory Log file :10 main 5432 online postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log :11 main 5433 online postgres /var/lib/postgresql/11/main /var/log/postgresql/postgresql-11-main.log # PostgreSQL was started during installation, stop it again: systemctl stop postgresql # Drop the default PostgreSQL 11 cluster created during installation: pg_dropcluster 11 main # Verify the clusters (output included): pg_lsclusters :Ver Cluster Port Status Owner Data directory Log file :10 main 5432 down postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log # Perform the data migration (slow to complete): pg_upgradecluster --method=upgrade 10 main # Drop the PostgreSQL 10 data as there are two copies (10+11): pg_dropcluster --stop 10 main # Remove the old PostgreSQL version & friends: apt-get remove --purge postgresql-10 postgresql-client-10 postgresql-server-dev-10 # Start the DB (maintenance still required, not ready for system uptime): systemctl start postgresql # From the PostgreSQL shell (psql): # The CLUSTER is optional, it takes time but can shrink the DB size considerably if not done recently VACUUM VERBOSE; -- CLUSTER VERBOSE events; ANALYZE VERBOSE; # This is a good time for restart (optional). New kernel? Long uptime & non-ECC RAM? reboot # Now the system is ready for production, start it up mentat-controller.py --command enable systemctl start apache2 mentat-controller.py --command start