Galera Load Balancer provides simple TCP connection balancing developed with scalability and performance in mind. It draws on Pen for inspiration, but its functionality is limited to only balancing TCP connections.
Unlike Galera Cluster, there is no binary installation available for Galera Load Balancer. Installing it on your system requires that you build it from source. It is available on GitHub at glb.
To build Galera Load Balancer, complete the following steps:
From a directory convenient to you for source builds, such as /opt, use Git to clone the GitHub repo for Galera Load Balancer.
$ git clone https://github.com/codership/glb
Change into the new glb/ directory created by Git, then run the bootstrap script.
$ cd glb/ $ ./bootstrap.sh
Configure Make to build on your system.
Build the application with Make.
Install the application on your system.
# make install
Galera Load Balancer installs in /usr/sbin. You need to run the above command as root.
Galera Load Balancer is now installed on your system. You can launch it from the command-line, using the glbd command.
In addition to the system daemon, you have also installed libglb, a shared library for connection balancing with any Linux applications that use the connect() call from the C Standard Library.
The above installation procedure only installs Galera Load Balancer to be run manually from the command-line. However, you may find it more useful to run this application as a system service.
In the source directory you cloned from GitHub, navigate into the files/ directory. Within this directory there is a configuration file and a service script that you need to copy to their relevant locations.
Place glbd.sh into /etc/init.d directory under a service name.
# cp glbd.sh /etc/init.d/glb
Place glbd.cfg into either configuration directory. For Red Hat and its derivatives, this is /etc/sysconfig/glbd.cfg. For Debian and its derivatives, use /etc/default/glbd.cfg.
# cp glbd.cfg /etc/sysconfig/glbd.cfg
The glbd.cfg configuration file used below refer to the one you have copied into /etc.
When you finish this, you can manage Galera Load Balancer through the service command. For more information on available commands, see Using Galera Load Balancer.
When you run Galera Load Balancer, you can configure its use through the command-line options, which you can reference through the --help command. For users that run Galera Load Balancer as a service, you can manage it through the glbd.cfg configuration file.
# Galera Load Balancer COnfigurations LISTEN_ADDR="8010" DEFAULT_TARGETS="192.168.1.1 192.168.1.2 192.168.1.3" OTHER_OPTIONS="--random --top 3"
Galera Load Balancer, both the system daemon and the shared library, support five destination selection policies. When you run it from the command-line, you can define these using the command-line arguments, otherwise add the arguments to the OTHER_OPTIONS parameter in the glbd.cfg configuration file.
In the above section Service Installation, you configured your system to run Galera Load Balancer as a service. This allows you to manage common operations through the service command, for instance:
# service glb getinfo Router: ------------------------------------------- Address : weight usage cons 192.168.1.1:4444 : 1.000 0.000 0 192.168.1.2:4444 : 1.000 0.000 0 192.168.1.3:4444 : 1.000 0.000 0 ------------------------------------------- Destinations: 3, total connections: 0
The service script supports the following operations:
When adding an IP address to Galera Load Balancer at runtime, bear in mind that it must follow the convention: IP Address:port:weight. When adding through a hostname, the convention is Hostname:port:weight.