Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Google Cloud Platform icon
Labs

Implement a Write Scalable Cluster Using MariaDB Galera Cluster and Galera Load Balancer

In this hands-on lab, you are working as a DBA and have been tasked with configuring a Write Scalable MariaDB Galera Cluster. The cluster is already up and running, but you will need to install the Galera Load Balancer and configure it appropriately.

Google Cloud Platform icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Apr 13, 2025
Duration
15m

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

    The database nodes are running and connected to the cluster, however the root user's password has not been set. You must first set the root user's password by running the mysql_secure_installation script:

    sudo mysql_secure_installation
    

    Now you can connect to the database as the root user and create a user account:

    mysql -u root -p
    

    Once connected, you can use the following SQL to create a user named remote who is able to log in remotely. Be sure to replace mypasswd with a password of your choice:

    create user remote identified by 'mypasswd';
    grant usage on *.* to 'remote'@'%' identified by 'mypasswd';
    
  2. Challenge

    Install the Prerequisite Packages
    sudo yum -y install git autoconf automake libtool gcc-c++ nmap-ncat
    
  3. Challenge

    Build the Binaries
    git clone https://github.com/codership/glb
    cd glb
    ./bootstrap.sh
    ./configure
    make
    sudo make install
    
  4. Challenge

    Configure and Start Galera Load Balancer

    We will start one node. More nodes can be added as necessary.
    The least-connection policy is used by default to distribute connections across nodes:

    sudo cp /home/cloud_user/glb/files/mysql.sh /usr/local/bin/mysql-check.sh
    sudo cp /home/cloud_user/glb/files/glbd.sh /etc/init.d/glb
    
    sudo vim /etc/sysconfig/glbd
    
    # Address to listen for client connections at. Mandatory parameter.
    # To bind to all interfaces only port should be specified.
    LISTEN_ADDR="10.0.1.100:13306"
    
    # Address for controlling connection. Mandatory part is port.
    # If not specified control socket will not be opened
    CONTROL_ADDR="127.0.0.1:4444"
    
    # Target servers for client connections, space separated.
    # Target specification: IP[:PORT[:WEIGHT]] (WEIGHT and PORT optional)
    # WEIGHT defaults to 1, PORT defaults to LISTEN_ADDR port.
    DEFAULT_TARGETS="10.0.1.100:3306:1"
    
    # Other glbd options if any as they would appear on the command line.
    OTHER_OPTIONS="--watchdog exec:'/usr/local/bin/mysql-check.sh -uremote -pmypasswd'"
    
    sudo service glb start
    sudo service glb status
    
  5. Challenge

    Confirm Connection to Node

    Create a new connection:

    mysql -u root -P 13306 -h 10.0.1.100 -p
    

    Confirm connection count in GLB:

    sudo service glb status
    
  6. Challenge

    Add Node and Confirm New Connections Are Routed Correctly

    Add the node:

    sudo service glb add "10.0.1.110:3306:1"
    

    Confirm connection:

    sudo service glb status
    
About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

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.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight