Migrate Existing OnApp Database from MySQL to MariaDB, Percona Servers, or Percona Cluster

 Install tool for OnApp database migration

  1. Skip the tool installation if OnApp Control Panel and MySQL Server run on the same box.
  2. Install OnApp's YUM repository:

    # rpm -Uvh http://rpm.repo.onapp.com/repo/onapp-repo.noarch.rpm
  3.  Install the onapp-mysql package:

    # yum -y install onapp-mysql

Prepare OnApp to the migration

  1. Process with regular Control Panel upgrade to the most recent version.
  2. Make sure you have no transactions and/or other tasks running.

  3.  Stop monitonapphttpd and crond services if your MySQL Server is installed outside of OnApp Control Panel box.

    The migration tool will stop the monit, onapp, httpd and crond services automatically if OnApp Control Panel and MySQL Server run on the same box. 

Start the migration

  1.  Log via ssh as root into the box where MySQL server is installed.

  2. Run the migration tool with -h option for options full list:

    # /onapp/onapp-mysql/onapp-db-migrate.sh -h
    Usage: /onapp/onapp-mysql/onapp-db-migrate.sh --mariadb | --percona | --percona-cluster [--mysqlhost MYSQL_HOST [--mysqlport MYSQL_PORT]|--mysqlsock MYSQL_SOCK]
      [--mysqlpassword MYSQL_PASSWD] [--mysqldb MYSQL_DB] [--mysqluser MYSQL_USER] [--dumpfile DUMP_FILE] [--skipdump] [-h|--help]

    Migrate existing OnApp Control Panel's database into:

    --mariadbMariaDB Server
    --perconaPercona Server
    --percona-clusterPercona Cluster
    MYSQL_*

    Set one of the options if you are not sure the config/database.yml includes correct configuration.

    --mysqlhost MYSQL_HOST
    MySQL host
    --mysqlport MYSQL_PORT
    MySQL port
    --mysqlsock MYSQL_SOCK

    MySQL socket

    --mysqlpasswd MYSQL_PASSWD
    MySQL password
    --mysqldb MYSQL_DB
    OnApp MySQL database
    --mysqluser MYSQL_USER
    MySQL user
    --dumpfile DUMP_FILE
    Custom file name (with full path included) to database dump file.Otherwise, /onapp/interface/db/dump/*.migrate.sql is used.The option is ignorred if -r is used
    --skipdump
    Skip database dump and restore
    -h|--help
    Print this info
    • The database is still stored as single file if --skipdump option is used.
    • At least on of -mariadb, percona or -percona-cluster options should be specified.
  3. Run the migration as:
     - CP and MySQL are the same box

    /onapp/onapp-mysql/onapp-db-migrate.sh --mariadb|--percona|--percona-cluster

     - CP and MySQL are different boxes

    /onapp/onapp-mysql/onapp-db-migrate.sh --mariadb|--percona|--percona-cluster --mysqlpasswd=MYSQL_PASSWORD
  4. During the migration, the tool will:

  • CP and MySQL are the same box determine connection data to the MySQL server from config/database.yml

  • check MySQL connection, and database presence

    mysqld service must be running during the migration

  • CP and MySQL are the same box stop monit, onapp, httpd, crond services
  • dump MySQL database (if --skipdump isn't used)
  • remove all MySQL related package (with --nodeps rpm option)
  • install one of chosen MariaDB, Percona Server or Percona Cluster using MySQL installer standalone onapp-mysql.sh
  • remove InnoDB logfiles ib_logfile*
  • install the most recent packages

    Please note,that we are not the packages' maintainer.The packages are provided by corresponding vendors. The following versions are used at the moment both for the RHEL/CentOS 5.x and 6.x.:

    MariaDB Server - 5.5.47
    Percona Server/Cluster - 5.6.27

  • start mysql service
  • check MySQL databases (with mysqlcheck --all-databases --check-upgrade --auto-repair)

  • update MySQL databases (with mysql_upgrade)

  • stop mysql service

  • remove InnoDB logfiles ib_logfile*

  • configure the database server relatively to amount of available RAM, and put corresponding /etc/my.cnf or /etc/my.cnf.d/server.cnf

  • start the mysql service

  • restore the dump (if --skipdump  isn't used)

  • CP and MySQL are the same box reconfigure the Monit services (to pick up new database server) using onapp-cp-monit.sh
  • CP and MySQL are the same box start the monit, crond, onapp and httpd services

  • set one of the .maridb.percona or .percona-cluster flags in the /onapp/onapp-mysql if migration succeeded (to indicate proper database server usage every time OnApp is upgraded).


  • There is no automated way to switch back to MySQL.
  • All issues, which caused the migration failure, should be resolved manually.
  • Please note to start all services if the migrate failed or CP and database are separate boxes 
  • The steps above are for existing OnApp installs only.