OnApp Database Server Installation

  • The document is not step by step instruction. It only describes available options, for Standalone Database Server installation (separately from Control Panel box). The server can later be used to store data by OnApp components (such as Control Panel or Zabbix Server) version >= 6.3.
  • The database server is configured using predefined config (my.cnf) relatively to total available amount of RAM on box.  
  • MariaDB new version 10.4 has been using to serve OnApp’s database since version 6.3 Edge 1.


  1. Specific installer (onapp-mysql.sh) is used to install the database server. To get the installer you need to:
    • Install YUM repository of the corresponding OnApp version (change x.x into your version):

      db# rpm -Uvh http://rpm.repo.onapp.com/repo/onapp-repo-x.x.noarch.rpm


    • Install the onapp-mysql package which contains the installer:

      db# yum -y install onapp-mysql
  2. The installer script full path and options list:

    db# /onapp/onapp-mysql/onapp-mysql.sh -h
    Usage: /onapp/onapp-mysql/onapp-mysql.sh [--mysqlsock[=MYSQL_SOCK] | --mysqlhost=MYSQL_HOST [--mysqlport=MYSQL_PORT] [--mysqluser=MYSQL_USER] [--mysqlpasswd=MYSQL_PASSWD] [--cp-mysql-port=CP_MYSQL_PORT] [--grantfrom=GRANTED_HOSTS --with-grant-option] --installonly [--mariadb | --mariadb-custom | --percona | --community | --percona-cluster [--bootstrap] ] [-h|--help]
    
    --mysqlhost=MYSQL_HOST      : IP address/FQDN where MySQL Server runs.
                                  Default value is localhost for the local installation.
    
    --mysqlport=MYSQL_PORT      : TCP port where MySQL Server serves connections.
                                  Default values is 3306 for the local installation
    
    --cp-mysql-port=CP_MYSQL_PORT : Control Panel to MySQL Server connection TCP port if it differs from MYSQL_PORT (where MySQL listens). The option could be useful if High Availability is enabled. --mysqlsock[=MYSQL_SOCK] : Unix socket on which MySQL Server serves connections. Default values is /var/lib/mysql/mysql.sock. Used if local server only The socket is unset if the option's argument isn't specified. --mysqluser=MYSQL_LOGIN : MySQL Server user with administrative previleges. Default value is 'root'. --mysqlpasswd=MYSQL_PASSWD : MySQL Server "root" user's password.
    --grantfrom=GRANTED_HOSTS : Comma separated list of hosts' IP addresses which are granted to access the MySQL Server with administrative previleges.
    --with-grant-option : Grant access for GRANTED_HOSTS with grant option. Can be used with --grantfrom only.
    --installonly : Just install corresponded packages. Do not onfigure server (except of "root" user password) Conflicts with: --bootstrap, --grantfrom
    Default is MySQL Server. It is also possible to use one of the following "MySQL compatible" servers: --mariadb : MariaDB Server --mariadb-custom : MariaDB Server custom version. Applies to RHEL/CentOS 7.x only. --community : MySQL 5.6 Community Server --percona : Percona Server --percona-cluster : Percona Cluster --bootstrap : Percona Cluster specific option to start the server in bootstrap mode -h|--help : print this info



  3. The installer will install a MySQL-like database server. Connection credentials for the database will be available at:

    db# cat /onapp/.my.cnf 
    port=3306
    user=root
    password=PASSWORD
  4. Mandatory options of the installer:
    • On CentOS 6.x box

      --mariadb

    • On CentOS 7.x box

      --mariadb-custom

  5. Useful options of the installer:

    • To grant connections from outside and IP_ADDRESS1,IP_ADDRESS2, ... (IP addresses are separated with commas)

      --grantfrom='IP_ADDRESS1,IP_ADDRESS2'

  6. Example of standalone database server installation, which can later be used by OnApp Control Panel
    • On CentOS 6.x box

      db# /onapp/onapp-mysql/onapp-mysql.sh --mariadb --grantfrom='CP_IP_ADDRESS' --mysqlhost=localhost
    • On CentOS 7.x box

      db# /onapp/onapp-mysql/onapp-mysql.sh --mariadb-custom --grantfrom='CP_IP_ADDRESS' --mysqlhost=localhost


    • Then, while doing Install Control Panel Server on "Run the Control Panel Installer" step, just pass extra options:

      cp# /onapp/onapp-cp-install/onapp-cp-install.sh ... -m MYSQL_HOST -p PASSWORD --mysql-sock

      Where:
      MYSQL_HOST - standalone database server IP address
      PASSWORD - standalone database MySQL root user password


      7. Example of the standalone database server installation, which can later be used by OnApp Zabbix Server

    • On CentOS 6.x box:

      db# /onapp/onapp-mysql/onapp-mysql.sh --mariadb --grantfrom='ZABBIX_HOST' --mysqlhost=localhost
    • On CentOS 7.x box:

      db# /onapp/onapp-mysql/onapp-mysql.sh --mariadb-custom --grantfrom='ZABBIX_HOST' --mysqlhost=localhost


    • Then, install the Zabbix server as:

      zabbix# /onapp/onapp-zabbix/onapp-zabbix.sh --mysqlhost=MYSQL_HOST --mysqlpasswd='PASSWORD'


      8. To install other MySQL compatible standalone databases, use the following options for the database installer:

MariaDB Server

    • On CentOS 6.x box
      --mariadb

    • On CentOS 7.x box
      --mariadb-custom

          Percona Server
          
--percona

          Percona Cluster
       
  --percona-cluster --grantfrom='WSREP_NODE_INCOMING_IP' --bootstrap

     
         Where:

         WSREP_NODE_INCOMING_IP - IP address at which the node accepts client connections.

         --bootstrap is useful when installing the first node of the Percona Cluster.