Install Galera Load Balancer on This Running MariaDB Galera Cluster

1 hour
  • 5 Learning Objectives

About this Hands-on Lab

In this activity, you are a DBA working for a large financial company and have been tasked with installing the Galera Load Balancer on a proof of concept MariaDB Galera Cluster.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Set the root Database User’s Password and Create a Database User Account
  1. Run the mysql_secure_installation script using the provided lab credentials:

    sudo mysql_secure_installation
    1. Configure the following settings:

      • Enter current password for root (enter for none): Enter
      • Switch to unix_socket authentication: y
      • Change the root password: y
      • New password: Any new password
      • Remove anonymous users? y
      • Disallow root login remotely? y
      • Remove test database and access to it? y
      • Reload privilege tables now? y
    2. Connect to the database as the root user and create a user account, using the newly created root password:

    mysql -u root -p
    1. Create a remote user, replacing "mypasswd" with a password of your choice:
    create user remote identified by 'mypasswd';
    1. Grant remote usage on all objects and allow user to log in from any host:
    grant usage on *.* to 'remote'@'%' identified by 'mypasswd';
    1. Enter quit to quit the program.
Install the Prerequisite Packages and Build the Binaries
  1. Install the packages for building Galera Load Balancer, using the password provided for node0 on the lab page:

    sudo yum -y install git autoconf automake libtool gcc-c++ nmap-ncat
  2. Clone the GitHub repository:

    git clone
  3. Move into the glb repository:

    cd glb/
  4. Run the Bootstrap script:

  5. Run the configure script:

  6. Create the binaries:

  7. Install the binaries:

    sudo make install
Start Galera Load Balancer
  1. Start the GLB manually on the command line:

    glbd -v -c
  2. Open a second terminal window and log in to node1 using the provided lab credentials:

    ssh cloud_user@<PUBLIC_IP_ADDRESS>
  3. Connect to the cluster on node1 using the newly created remote user login credentials:

    mysql -u remote -h -P 13306 -p
  4. Return to the node0 terminal and confirm the connection was made.

Add Nodes and Query Stats
  1. Open up a new terminal window and log in to node0 using the provided lab credentials:

    ssh cloud_user@<PUBLIC_IP_ADDRESS>
  2. Add a node using port 4444:

    Note: This command must be run on the same node as the load balancer.

    echo "" | nc 4444
  3. Return to the first node0 terminal (the one running the load balancer) and confirm the second node is running.

  4. Query for statistics on the control port:

    echo "getstat"  | nc 4444
  5. Close the first node0 terminal window to stop the service.

Configure and Start Galera Load Balancer as a Daemon
  1. On node0, move into the files directory of the cloned GitHub repository:

    cd glb/files
  2. Copy the Galera Load Balancer shell script file and log in using provided lab credentials:

    sudo cp /etc/init.d/glb
  3. Copy the configuration file to /etc/sysconfig/glbd:

    sudo cp glbd.cfg /etc/sysconfig/glbd
  4. Edit the configuration file:

    sudo vim /etc/sysconfig/glbd
  5. Uncomment and edit the following file parameters:

    • Set the listen address: LISTEN_ADDR="13306"
      • Change the control address: CONTROL_ADDR=""
      • Set both nodes as default targets: DEFAULT_TARGETS=""
  6. Hit :wq! to save and exit the file.

  7. Start the service and check its status:

    sudo service glb start
    sudo service glb status
  8. Query for load balancer statistics:

    sudo service glb getstats
  9. Remove nodes:

    sudo service glb remove
  10. Add nodes:

    sudo service glb add

Additional Resources

In this activity, you are a DBA working for a large financial company and have been tasked with installing the Galera Load Balancer on a proof of concept MariaDB Galera Cluster. To accomplish this, you will need to complete the following tasks:

  1. Set the root database user's password and create a database user account.
  2. Install the prerequisite packages.
  3. Build the binaries.
  4. Start Galera Load Balancer.
  5. Add nodes and query stats.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?