The cart is empty

Running multiple versions of MariaDB databases on a single server can be essential in scenarios where different applications require different database versions or during a phased transition between versions. This article focuses on the specific procedures and best practices for installing and managing multiple versions of MariaDB on a single server.

Preparing the Server

  1. Backup Existing Data: Before making any changes, perform a complete backup of all existing databases and configurations to ensure you can restore everything in case of issues.

  2. System Updates: Ensure your operating system and all important packages are up-to-date. For Debian-based systems, use the following commands:

    sudo apt update
    sudo apt upgrade
    

 

Installing Multiple Versions of MariaDB

  1. Using Docker: Docker is an ideal tool for running multiple versions of MariaDB on a single server due to its ability to isolate individual database instances. Install Docker according to the official documentation.

  2. Download Docker Images for Different MariaDB Versions: Download the required MariaDB versions using Docker:

    docker pull mariadb:10.5
    docker pull mariadb:10.6
    docker pull mariadb:10.11
    
  3. Run Containers for Each Version: Create and run a container for each MariaDB version on different ports:
    docker run -d --name mariadb_10_5 -e MYSQL_ROOT_PASSWORD=root_password -p 3306:3306 mariadb:10.5
    docker run -d --name mariadb_10_6 -e MYSQL_ROOT_PASSWORD=root_password -p 3307:3306 mariadb:10.6
    docker run -d --name mariadb_10_11 -e MYSQL_ROOT_PASSWORD=root_password -p 3308:3306 mariadb:10.11
    ​

Configuring and Managing Multiple Instances

  1. Access and Configuration Settings: Ensure each instance has properly configured configuration files and access rights. You can modify the configuration for each instance as needed:

    docker exec -it mariadb_10_5 bash
    vi /etc/mysql/my.cnf
    
  2. Managing Connections and Performance: Monitor the load on each instance and optimize their performance. Tools like top, htop, or docker stats can be used to monitor container performance.

 

Securing the Databases

  1. Data Encryption and Security: Ensure data is encrypted and access rights are correctly set. Use the relevant MariaDB features for data encryption.

  2. Network Security: Configure the firewall to allow access to the databases only from authorized IP addresses. For Debian-based systems, you can use ufw:

    sudo ufw allow from your_ip_address to any port 3306
    sudo ufw allow from your_ip_address to any port 3307
    sudo ufw allow from your_ip_address to any port 3308
    

Regular Updates and Backups: Keep all MariaDB instances updated and perform regular backups to ensure data recovery in case of failure.

Running multiple versions of MariaDB databases on a single server can be effectively managed using Docker. This method allows for isolating individual versions and ensuring their proper operation without conflicts. Proper configuration, performance monitoring, and securing the databases are key factors for successfully deploying and operating multiple versions of MariaDB on a single server.