Deploy MariaDB Xpand Instance on CentOS 7

These instructions detail the deployment of MariaDB Xpand Instance on CentOS Linux 7.

Xpand Instances are part of MariaDB Xpand's separate deployment type. These deployments are suited for a transactional or OLTP workload that requires distributed SQL, high availability (HA), fault tolerance, and horizontal scale-out.

Note

MariaDB Xpand is a beta release.

Xpand Deployment Types

Xpand Instances are a component of the separate MariaDB Xpand deployment type. In a separate MariaDB Xpand deployment, Xpand Instance back-ends run on separate hosts from the MariaDB Enterprise Server front-ends.

However, the recommended deployment type for most users is a combined MariaDB Xpand deployment. In a combined MariaDB Xpand deployment, Xpand Nodes function both as Xpand Instance back-ends and as MariaDB Enterprise Server front-ends.

See the following resources for how to deploy an Xpand Node in a combined MariaDB Xpand deployment instead:

Dependencies

These instructions assume that one or more MariaDB Enterprise Server front-ends will also be deployed.

See the following resources for how to deploy a MariaDB Enterprise Server front-end for Xpand:

MariaDB Platform Components

These instructions detail the deployment of the following MariaDB Platform components:

Component

Description

MariaDB Xpand

  • It provides a storage back-end for Xpand tables on MariaDB Enterprise Server 10.5.

Term Definitions

Term

Definition

MariaDB Enterprise Server (front-end)

  • MariaDB Enterprise Server with Xpand plugin.

  • Receives queries from clients, applications, or MariaDB MaxScale.

  • Uses Xpand Instances as back-end storage for Xpand tables.

Xpand Instance (back-end)

  • MariaDB Xpand back-end instance.

  • Stores and serves data for Xpand tables that were created on MariaDB Enterprise Server front-ends.

  • Connects to other Xpand instances to distribute data slices and maintain replicas.

Xpand Node

  • This is the recommended server type for most users.

  • In a combined deployment type, it acts both as a MariaDB Enterprise Server front-end and as a MariaDB Xpand Instance back-end.

System Configuration

Xpand Nodes require some system-level configurations to prevent SELinux and firewalld from blocking network communication.

SELinux

To set SELinux to permissive mode:

  1. Edit the SELinux configuration file:

    $ sudo vim /etc/selinux/config
    
  2. Change the SELINUX variable to permissive mode:

    SELINUX=permissive
    
  3. Then, set the current SELinux process to permissive mode:

    $ sudo setenforce permissive
    
  4. Check that SELinux is in permissive mode using the sestatus command:

    $ sudo sestatus
    SELinux status:                 enabled
    SELinuxfs mount:                /sys/fs/selinux
    SELinux root directory:         /etc/selinux
    Loaded policy name:             targeted
    Current mode:                   permissive
    Mode from config file:          permissive
    Policy MLS status:              enabled
    Policy deny_unknown status:     allowed
    Max kernel policy version:      31
    

Firewall Configuration:

Disable firewalld to prevent it from blocking Xpand Instance communication:

To disable firewalld:

  1. Stop firewalld and disable it at startup:

    $ sudo systemctl stop firewalld
    $ sudo systemctl disable firewalld
    

Installation

MariaDB Corporation provides a YUM package repository for CentOS Linux 7.

Install via YUM (RHEL/CentOS)

To install MariaDB Xpand:

  1. Install the required package dependencies:

    $ sudo yum install bzip2 xz wget screen ntp ntpdate vim htop mdadm
    
  2. Contact MariaDB Sales for the Xpand back-end package and upload it to your server.

  3. Untar the Xpand back-end package and change into the directory:

    $ tar xvf xpand-5.3.11_rc.el7.tar.bz2
    
    $ cd xpand-5.3.11_rc.el7
    
  4. Run the installation script:

    $ ./xpdnode_install.py
    

    Note, the xpdnode_install.py script expects to find the Xpand data and log directories on separate drives. If you don't want to do this, use the --force option.

Configuration

MariaDB Xpand requires some additional configuration for the nodes to connect to one another and function as a back-end to MariaDB Enterprise Server with the Xpand storage engine.

License Configuration

MariaDB Xpand requires that you set the license key for your deployment. This license is a JSON object, which can be obtained from MariaDB Corporation and need only be set on the node used to start the deployment.

To set the license:

  1. On a Xpand node, use the MariaDB Client with its legacy name (mysql) to connect to the Xpand instance:

    $ sudo mysql
    
  2. Use a SET statement to configure the license variable:

    SET GLOBAL license = 'license_json';
    

The license is now set for your deployment of MariaDB Xpand. You can now add additional nodes to the deployment.

Setting Path for Xpand Binaries

MariaDB Xpand installation provides a bin/ directory with Xpand related commands. For convenience, add the path to this directory to the $PATH environmental variable:

  1. Edit the .bash_profile file:

    $ vim ~/.bash_profile
    
  2. Add the bin/ directory to the $PATH variable:

    export PATH=$PATH:/opt/clustrix/bin
    
  3. Save the file, then source the .bash_profile file to update the variable:

    $ source ~/.bash_profile
    

NTP Configuration

MariaDB Xpand requires NTP to synchronize system clocks between the various Xpand Instances.

To enable NTP:

  1. Start the NTP daemon and enable it at startup:

    $ sudo systemctl start ntpd
    $ sudo systemctl enable ntpd
    

Granting Privileges to Servers

MariaDB Enterprise Servers with the Xpand plugin operate as the front-ends to MariaDB Xpand. For each Server you add as a front-end, issue a GRANT statement for a user at that IP address or domain.

To grant privileges on a new Server:

  1. Use the MariaDB Client with its legacy name (mysql) to connect to the Xpand instance:

    $ sudo mysql
    
  2. Create the user account using the CREATE USER statement:

    CREATE USER xpand_user@192.0.2.1
       IDENTIFIED BY 'xpand_user_passwd';
    
  3. Grant the user account the proper privileges with the GRANT statement:

    GRANT ALL ON *.* TO xpand_user@192.0.2.1;
    
  4. In the MariaDB Enterprise Server configuration, set the xpand_username and xpand_password system variables to the values for the corresponding user account:

    [mariadb]
    xpand_username = xpand_user
    xpand_password = xpand_user_passwd
    

    When the Server operates on an Xpand table, it now uses these credentials in connecting to the Xpand nodes.

Scaling out Xpand Instances

Xpand Instances distribute data between themselves in a shared-nothing architecture. By adding Xpand Instances to your deployment, you can provide increased processing and storage capabilities to your deployment.

  • You can add instances from any existing Xpand Instance.

  • The first Xpand Instance in the deployment is the one in which you set the license key.

Xpand Instances are added to the deployment using an ALTER CLUSTER statement.

To add Xpand nodes to the deployment:

  1. Use the MariaDB Client with its legacy name (mysql) to connect to the Xpand instance:

    $ sudo mysql
    
  2. Issue an ALTER CLUSTER statement to add the nodes to the deployment:

    ALTER CLUSTER ADD '192.0.2.11', '192.0.2.12';
    

MariaDB Xpand connects to the other Xpand nodes and configures them to receive connections.

SSH Configuration

MariaDB Xpand installation configures two users to handle Xpand processed on the host:

User

Description

xpand

User for the database daemon, which is used in upgrades.

xpandm

User for management and monitoring functions.

When adding Xpand Instances to your deployment, configure these users for password-less SSH connections.

To configure SSH:

  1. On each new Xpand Instance, set the password for each user:

    $ sudo passwd xpand
    $ sudo passwd xpandm
    
  2. Then, on any existing Xpand Instance, run clx to configure the public keys:

    $ sudo clx pubkeyinstall
    

clx requests the password for the users, then uses the list of Xpand nodes in the deployment configuration, connecting to each to apply the relevant SSH configurations.

Starting MariaDB Xpand

MariaDB Xpand automatically starts the Xpand Instance during installation. To control it otherwise, use the clx command.

Operation

Command

Start

sudo clx dbstart

Stop

sudo clx dbstop

Restart

sudo clx dbrestart

Status

sudo clx status

Testing

Using the clx command, check the status of the Xpand Instances in your deployment.

$ clx status
Cluster Name:    example-xpand-instances
Cluster Version: 5.3.11_rc
Cluster Status:  OK
Cluster Size:    3 nodes - 6 CPUs per Node
Current Node:    xpand-node-1 nid 1

nid |   Hostname  | Status | IP Address | TPS |       Used      |  Total
----+-------------+--------+------------+-----+-----------------+--------
  1 | xpand-node1 |    OK  | 192.0.2.15 |   0 |   48.3M (0.02%) |  231.9G
  2 | xpand-node2 |    OK  | 192.0.2.30 |   0 |   46.3M (0.02%) |  231.9G
  3 | xpand-node3 |    OK  | 192.0.2.60 |   0 |   46.3M (0.02%) |  231.9G
----+-------------+--------+------------+-----+-----------------+--------
                                            0 |  140.9M (0.02%) |  695.6G

The clx command provides information on each Xpand Instance in the deployment, including their IP address, status, and data usage.