Database Upgrade from MySQL to MariaDB

Automatics is running on MySQL v5.6, which is at EOL as per https://www.mysql.com/support/eol-notice.html so we are had upgraded to the latest MariaDB (LTS) community server v10.11(support till February 2028 as per this). We have done the upgrade with reverse compatibility in mind so that this upgrade in the Automatics application wont affect the existing users who are currently using MySQL database. This upgrade will bring latest features & security in database tier to Automatics.

Steps to Upgrade from MySQL 5.6 to MariaDB 10.11

The below are the steps to be followed for upgrading the existing MySQL database of Automatics (for both Orchestration and Device Manager) to MariaDB.

  1. Check the MariaDB Version

    sudo mysql -u <<DB_USERNAME>> -p -V
  2. Backup the Database

    When performing an upgrade, creating a backup or a dump of the existing databases is important just in case if something goes wrong. Dump the database with the following command.

    sudo mysqldump -u <<DB_USERNAME>> -p --all-databases > /tmp/database-backup.sql

    Alternatively, copy the database directory into a separate folder using this command.

    sudo cp -a /var/lib/mysql /var/lib/mysql.backup

    Backup the configuration file with this command.

    sudo cp -a /etc/my.cnf /etc/my.cnf_bk

    In case of any failures in the upgrade, you can use one of the above copies to restore your databases.


  3. Uninstall the Current MariaDB Repository.You will need to uninstall the old MySQL database before installing the newer version. To do so, you must first stop the MySQL service using the below command.

    sudo systemctl stop mysql

    Check the current status of MySQL using this command.

    sudo systemctl status mysql
  4. Add the New MariaDB Repository

    All the packages need to be up-to-date. Use the following command to update your packages.

    sudo yum update

    Create a new repo file for the latest version.

    vi /etc/yum.repos.d/MariaDB.repo

    Copy and paste the following contents into the /etc/yum.repos.d/mariadb.repo file.

    [mariadb]
    name = MariaDB
    baseurl = http://yum.mariadb.org/10.11/centos7-amd64
    gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
    gpgcheck=1

    To exit and save the Vim file, type :wq and press Enter.


  5. Uninstall the Old MySQL Version

    Uninstall the old version of MariaDB using the below command. This command completely removes the old MariaDB version and leaves the databases.

    sudo yum remove mysql
    sudo yum remove mysql-community-common
    sudo yum clean all
  6. Install the Latest Version of MariaDB

    Install 10.11 of MariaDB and the most common packages, using the command below.

    sudo yum install MariaDB-server galera-4 MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common
  7. Start MariaDB

    Start the MariaDB service with this command.

    sudo systemctl start mariadb

    To set MariaDB to start automatically when the VM boots up, use the following command.

    sudo systemctl enable mariadb

    Check the current status of MariaDB using this command.

    sudo systemctl status mariadb

    Check the currently installed MariaDB version with this command.

    sudo mysql -u root -p -V
  8. Upgrade MariaDB

    Run the upgrade command to upgrade MySQL database to MariaDB. This command will migrate all the existing databases with its data to latest installed MariaDB

    sudo mysql_upgrade -u root -p


    MariaDB has been successfully upgraded to the latest version.

Now you can login to the MariaDB using the below command and verify whether all the existing data is available in the Database.

sudo mysql -u root -p

Upgrade Automatics Tools to Open JDK-17

Automatics Tools are running on JDK 1.8, which is planned to be upgraded to JDK17 as per the request from the community members since new members on boarding to Automatics were not able to install JDK1.8 in the VMs. So we had planned to bring support to the JDK17 with reverse compatibility to JDK11.

Steps to Migrate from JDK1.8 to JDK17

The below are the steps to be followed for upgrading the existing JDK to JDK17

  1. Check the current JDK Version

    java -version
  2. Install JDK 17 in the VM

    sudo yum install java-17-openjdk
  3. Select the newly installed JAVA 17 from the list of JAVA in the VM

    sudo update-alternatives --config java

  4. Finaly confirm whether the java version is changed to JDK 17

    java -version

Upgrade Automatics Tools to deploy using Tomcat 9

Automatics Tools are currently deployed in Tomcat 7 and Tomcat 8.5, this needs to be upgraded to latest Tomcat 9 v9.0.85. You can use the below steps to upgrade to Tomcat 9

Steps to Upgrade to Tomcat 9

  1. Download Tomcat 9 from the Apache Tomcat Archive

    wget -c https://downloads.apache.org/tomcat/tomcat-9/v9.0.85/bin/apache-tomcat-9.0.85.tar.gz
  2. Extract the Tomcat archive to the directory in which you want to deploy the Automatics Tools


    sudo tar -xvf apache-tomcat-9.0.85.tar.gz -C /opt/automatics/
  3. Copy the .war files to the "/webapps" folder of new Tomcat and add the corresponding configuration to the "catalina.sh" file.
  4. Start the tomcat server by executing the "./startup.sh" shell script

Upgrade Automatics Framework to JDK17

Automatics Framework applications(Core, Utils & Partner Implementations) are running on JDK 11, which is upgraded to JDK17 as per the request from the community members. The current upgrade brings support to the JDK17 with reverse compatibility to JDK11.

Steps to Build and Execute Automatics Framework using JDK 17

  1. Install JDK 17 in the Jenkins VM, please follow the steps mentioned in the section Upgrade Automatics Tools to Open JDK-17 for the installation info
  2. Add JDK 17 home location to jenkins. For adding the same follow go to JENKINS HOME → Manage Jenkins → Tools → JDK INSTALLATIONS and add the name for JDK17 (this is to be referred when configuring JDK in jobs) and add the JDK 17 Home directory.
  3. Now open the Deployment, Parser  jobs of Automatics Framework (Core, Utils, Partner Implementation, Script-less Automation) along with Test Case Execution jobs and select JDK to JDK 17. For performing this step, open the Job Home Page → Configure → JDK and select JDK17 which you configured earlier in the step 2
  4. Now open the Test Case execution jobs of Automatics and add the below JVM Arguments to the job. For that open the Job Home Page → Configure → Build Steps → Invoke top-level Maven targets → Advanced → JVM Options and add the below line in the text field 
    --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.management/javax.management=ALL-UNNAMED --add-opens=java.desktop/sun.font=ALL-UNNAMED --add-opens=java.base/sun.reflect.generics.parser=ALL-UNNAMED --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED --add-opens=java.base/java.time.format=ALL-UNNAMED  --add-exports=java.base/sun.util.calendar=ALL-UNNAMED --add-exports=java.base/sun.security.action=ALL-UNNAMED --add-exports=java.xml/jdk.xml.internal=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED
  • No labels