Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon

Install Galera Load Balancer on This Running MariaDB Galera Cluster

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.

Google Cloud Platform icon

Path Info

Clock icon Intermediate
Clock icon 1h 0m
Clock icon Jul 23, 2020

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    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
    2. 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
    3. Connect to the database as the root user and create a user account, using the newly created root password:

      mysql -u root -p
    4. Create a remote user, replacing "mypasswd" with a password of your choice:

      create user remote identified by 'mypasswd';
    5. Grant remote usage on all objects and allow user to log in from any host:

      grant usage on *.* to 'remote'@'%' identified by 'mypasswd';
    6. Enter quit to quit the program.

  2. Challenge

    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
  3. Challenge

    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.

  4. Challenge

    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.

  5. Challenge

    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

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

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.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans