Steps to Upgrade MySQL to v8.0.40

Steps to Upgrade MySQL to v8.0.40

image-20240729-123126.png

Steps to upgrade MySQL to v8.0.40

Pre-requisites

Important Prerequisites to check before the upgrade.

  • MySql version of QMetry Reports and QMetry Application should be 8.0.33.

  • Ensure that QMetry is not in use and there are no ongoing operations or traffic on QMetry.

  • Please ensure that docker is authenticated in case of Online installation.

Steps:

→ In case of Offline Installation

Follow the steps to download and restore the QMetry Database image. After the image is successfully restored, you can then move forward with the next steps.

Download and restore the QMetry Database Image

  1. Download the Container Image of QMetry/Report DB

    Perform the following steps on a machine with internet access to download the container image:

    • Execute the command below to log in to the container repository. Enter the required credentials when prompted. If you do not have the credentials, contact QMetry Support.

      docker login
    • Download and save the QMetry Database container image by executing these commands:

      docker pull qmetry/qmetry:appdb8040 docker pull qmetry/qmetry:reportdb8040 docker images docker save -o qmetrydb.tar qmetry/qmetry:appdb8040 docker save -o reportdb8.tar qmetry/qmetry:reportdb8040 ls
    • Transfer the qmetrydb.tar, reportdb8.tar file to the host server where the installation will take place.

  2. Restore the Container Image of QMetry DB

Restore the container image on the target machine where the installation will be carried out:

  • If you are logged in as the "root" user, execute the following command. If not, skip this step:

    sudo su
  • Navigate to the directory containing the qmetrydb.tar,reportdb8.tar file and load the container image with the following command:

    docker load -i qmetrydb.tar docker load -i reportdb8.tar
  • Verify that the container images have been restored correctly by executing:

    docker images

After successful restoration, proceed with the subsequent steps.

Step 1: IMPORTANT: Backup Your Existing QMetry Database

Before proceeding, back up existing “qmetry” database. Adjust the username, password, and backup file location as needed (default location is /opt).

Command Syntax:

docker exec qmetryapp_db sh -c 'exec mysqldump -uroot -p<password> --triggers --routines --hex-blob --single-transaction --lock-tables --no-create-db qmetry' > /opt/qmetry_backup_<date>.sql

Example:

docker exec qmetryapp_db sh -c 'exec mysqldump -uroot -pqmetry --triggers --routines --hex-blob --single-transaction --lock-tables --no-create-db qmetry' > /opt/qmetry_backup_2023-01-01.sql

Step 2: Stop QMetry Services

Stop QMetry app and report containers.

docker stop qmetry_app_1 docker stop qmetry-reports

Step 3. Extract AppDBUpgrade.zip.

Copy the AppDBUpgrade.zip file received from QMetry Support to the server hosting the QMetry database container. Navigate to the directory containing the file and execute the following command:

// Unzip and Navigate to the AppDBUpgrade directory

unzip AppDBUpgrade.zip cd AppDBUpgrade

// Grant execute permissions and run the upgrade script:

chmod 777 dbupgrade.sh ./dbupgrade.sh

Once the script starts executing, it will prompt you to enter the following parameters:

Options

Details

Default Value

Example

Options

Details

Default Value

Example

Enter QMetry database password for root user

Enter QMetry Application Database Password for the root user.

-

QMetry@123

Step 4: Upgrade the Report Database:

Copy the ReportDBUpgrade.zip file received from QMetry Support to the server hosting both report and report-database container. Navigate to the directory containing the file and execute the following command:

// Unzip and Navigate to the ReportDBUpgrade directory

Unzip ReportDBUpgrade.zip cd ReportDBUpgrade

// Grant execute permissions and run the upgrade script:

chmod 777 dbupgrade.sh ./dbupgrade.sh

Once the installation initiates, it will prompt you to enter the following parameters:

Options

Details

Default Value

Example

Options

Details

Default Value

Example

Enter Report database password for root user

Enter password for QMetry Reports Database.

-

QMetryreports@!Nf0#

Enter Report database schema

Enter Database schema name for QMetry Reports Database.

qtmanalytics

qtmanalytics

Step 5: Restart QMetry Services:

Start the QMetry app and report containers.

docker start qmetry_app_1 docker start qmetry-reports

Step 6: Validate the Upgrade:

  • Check the QMetry app and report to ensure data integrity.

Step 7: Check Report sync functionality working or not.

These steps will help ensure a smooth upgrade from MySQL 8.x to MySQL 8.0.40.