Database Tier Installer

Prerequisites

This procedure documents the steps for installing the MySQL Cluster on VM's. Here VM's will be created manually using the virt-install CLI tool; MySQL Cluster will be installed using the db-install docker container.

For Installing the MySQL Cluster on these VM's requires an use of the an inventory file (hosts.ini) where all the MySQL node IP Address are configured. This Inventory file provides the db-install docker container with all the necessary information about the MySQL cluster.

MySQL Cluster will be installed using the MySQL Cluster Manager binary release which includes MySQL NDB Cluster version. Download MySQL Cluster Manager version as specified in the Installation Preflight Checklist.

In OCCNE platform, all the NF's will need a database to store application data, so MySQL Cluster is installed for storing all the application and config data for NF's. For installing MySQL Cluster, VM's will be created in kubernetes master nodes and Database Servers as configured in the Inventory File Template file.

Below are list of prerequisites required for creating the VM's and installing the MySQL Cluster.

  1. VM's needed for installing the MySQL Cluster will be created as part of the VM creation procedures Install VMs for MySQL Nodes and Management Server.
  2. SSH keys generated during the host provisioning in /var/occne/<cluster_name> directory, these SSH keys will be configured in these VM's as part of the OCCNE Install VMs for MySQL Nodes and Management Server, so that db-install container can install these VM's with the MySQL Cluster software.
  3. The host running the docker image must have docker installed.
  4. A defined and installed site hosts.ini inventory file should also be present..
  5. Download MySQL Cluster Manager software as specified in Installation PreFlight Checklist and place it in the /var/occne directory in bastion host(Management VM).

Limitations and Expectations

References

Steps to perform OCCNE Database Tier Installer

  1. db-install container will deploy MySQL cluster in these VM's as per configuration provided in the Inventory File Preparation file.
  2. The steps below will install different MySQL Cluster nodes(Management nodes, Data nodes and SQL nodes) in these VM's.

Table 3-12 OCCNE Database Tier Installer

Step # Procedure Description

1

Login in to the Management Node

Login in to the Management Node using the IP address noted in the Installation PreFlight Checklist

2

Check if MySQL Cluster node VM's are created

Check if MySQL Cluster node VM's are created in the Kuberentes Master nodes and Storage Hosts.

  1. Check MySQL Management Nodes are created in the Kubernetes master nodes
    1. Login to kubernetes Master node
      $ ssh -i .ssh/occne_id_rsa admusr@10.72.216.XXX
      $ sudo su
    2. Check if MySQL Management Node is installed in this Kubernetes Master Node.
      $$ virsh list --all
       Id    Name                           State
      ----------------------------------------------------
       2     db-3.rainbow.lab.us.oracle.com   running
    Check in all other Kubernetes Master nodes.
  2. Check MySQL Data nodes and MySQL SQL Nodes are installed in Storage Hosts
    1. Login to Storage Host
      $ ssh -i .ssh/occne_id_rsa admusr@10.72.216.XXX
      $ sudo su
    2. Check if MySQL Data nodes and SQL Nodes are installed in this Kubernetes Master Node.
      $ virsh list --all
       Id    Name                           State
      ----------------------------------------------------
      Id    Name                           State
      ----------------------------------------------------
       6     db-6.rainbow.lab.us.oracle.com   running
       7     db-8.rainbow.lab.us.oracle.com   running
       8     db-10.rainbow.lab.us.oracle.com  running
    Check in other Storage hosts.

3

Create MySQL Cluster Node VM If VM's are not created then follow below steps to create MySQL Cluster Node VM's in kubernetes Master nodes and Storage Hosts. Execute Install VMs for MySQL Nodes and Management Server for Installing VM's.

4

Configure occne_mysqlndb_DataMemory variable in the hosts.ini file

Check the /var/occne/<cluster_name> directory which has been created during the os install procedure, as specified in the Oracle Linux OS Installer, this directory consists of the hosts.ini inventory file and SSH keys generated during the os-install, which will be used by db-install container to install MySQL Cluster.

Configure occne_mysqlndb_DataMemory variable in the hosts.ini file as documented in Inventory File Preparation, value for this variable can be obtained from the Install VMs for MySQL Nodes and Management Server.

5

Note down the db install container name Note down the db install container name as specified in the manifest.
Container Name db_install_container_name db_install:0.1.0-beta.3
Note: This container will be used in the next step while running the db install container which will install MySQL Cluster

6

Configure the MySQL NDB Cluster with predefined database To configure the MySQL NDB Cluster with predefined database, tables and configurations related to different NF's, the .sql scripts can be copied in to the initdb_once and initdb directories. The .sql scripts in the initdb_once directory will be deleted after db_install container execute the .sql scripts.
$ sudo su
$ mkdir -p /var/occne/<cluster_name>/initdb_once
$ mkdir -p /var/occne/<cluster_name>/initdb
$ cp <source_path>/initdb_once/*.sql  /var/occne/<cluster_name>/initdb_once/ 
$ cp <source_path>/initdb/*.sql  /var/occne/<cluster_name>/initdb/

Example:

$ sudo su
$ mkdir -p /var/occne/rainbow/initdb_once
$ mkdir -p /var/occne/rainbow/initdb
$ cp /var/occne/nfscripts/initdb_once/*.sql  /var/occne/<cluster_name>/initdb_once/ 
$ cp /var/occne/nfscripts/initdb/*.sql  /var/occne/<cluster_name>/initdb/

Note: The *.sql scripts should be copied in to the bastion host, so the db_install container can create the databases, tables and configurations in the MySQL NDB Cluster.

7

Run db-install container
The db-install container will install MySQL Cluster on VM's configured in the host.ini inventory file. All the above steps should be performed before running the db-install container. Replace <customer_repo_location> and <db_install_container_name> in below docker command and docker-compose.yaml file.
  1. Using docker
    $ docker run -it --network host --cap-add=NET_ADMIN \
    -v /var/occne/<cluster_name>:/host \
    -v /var/occne:/var/occne:rw \
    <customer_repo_location>/<db_install_container_name>
    For Example:
    $ docker run -it --network host --cap-add=NET_ADMIN \
    -v /var/occne/rainbow/:/host \
    -v /var/occne:/var/occne:rw \
    reg-1:5000/db_install:1.2.0
  2. Using docker-compose
    1. Create a docker-compose.yaml file in the /var/occne/<cluster_name> directory.

      Using docker-compose
      $ vi docker-compose.yaml
      db_install_<cluster_name>:
        net: host
        stdin_open: true
        tty: true
        image: <customer_repo_location>/<db_install_container_name>
        container_name: <cluster_name>_db_installer
        cap_add:
          - NET_ADMIN
        volumes:
          - /var/occne/<cluster_name>:/host
          - /var/occne:/var/occne:rw
      Note: In above docker-compose.yaml file cluster_name should be replaced with the cluster directory name.
    2. Run the docker-compose yaml file
      Running docker-compose
      $ docker-compose run --rm db_install_<cluster_name>

      For example:

      If the directory name created as OccneCluster then cluster_name should be replaced with "OccneCluster".
      $ docker-compose run --rm db_install_<cluster_name>

    db_install container will take around 5 to 10 mins for installing the MySQL Cluster nodes in these VM's, After db_install container is completed MySQL DB is installed in the VM's as configured in the hosts.ini file.

8

Test the MySQL Cluster Test the MySQL Cluster by executing the following command:
$ docker run -it --network host --cap-add=NET_ADMIN \
-v /var/occne/<cluster_name>:/host \
-v /var/occne:/var/occne:rw \
<customer_repo_location>/<db_install_container_name> \
/test/cluster_test 0
For Example:
$ docker run -it --network host --cap-add=NET_ADMIN \
          -v /var/occne/rainbow:/host \
          -v /var/occne:/var/occne:rw \
          reg-1:5000/db_install:1.2.0 \
          /test/cluster_test

9

Login to the each of the MySQL SQL nodes and change the MySQL root user password
As part of the installation of the MySQL Cluster, db_install container will generate the random password and marked as expired in the MySQL SQL nodes. This password is stored in /var/occnedb/mysqld_expired.log file. so we need to login to the each of the MySQL SQL nodes and change the MySQL root user password.
  1. Login to MySQL SQL Node VM.
  2. Login to mysql client as a root user.
    $ sudo su
    $ mysql -h 127.0.0.1 -uroot -p
  3. Enter expired random password for mysql root user stored in the /var/occnedb/mysqld_expired.log file:
    $ mysql -h 127.0.0.1 -uroot -p
     Enter password:
  4. Change Root Password:
    $ mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '<NEW_PASSWORD>';
    $ mysql> FLUSH PRIVILEGES;

Perform this step for all the remaining SQL nodes.

Note: Here NEW_PASSWORD is the password of the mysql root user.

Uninstall MySQL Cluster Manager and MySQL NDB Cluster

Table 3-13 Uninstall MySQL Cluster Manager and MySQL NDB Cluster

Step Procedure Description

1

Login in to the Bastion host Login in to the Bastion host, IP address of this bastion host is noted in the Installation PreFlight Checklist

2

Run db_install Run db_install docker container
$ docker run -it --network host --cap-add=NET_ADMIN \
-v /var/occne/<cluster_name>:/host \
-v /var/occne:/var/occne:rw \
<customer_repo_location>/<db_install_container_name> /bin/bash

For Example:

$ docker run -it --network host --cap-add=NET_ADMIN \
-v /var/occne/rainbow/:/host \
-v /var/occne:/var/occne:rw \
reg-1:5000/db_install:1.2.0 /bin/bash

3

Uninstall MYSQL NDB Cluster Un-install MySQL NDB Cluster.
$ ansible-playbook -i /host/hosts.ini --become --become-user=root \

--private-key /host/.ssh/occne_id_rsa  /occne/cleanup.yaml
$ exit