Balance is a load balancing solution for simple TCP proxy with round robin load balancing and fail over mechanisms.
-
Configure Balance.
For Linux from Source:
-
Download Balance from the Balance download page.
Ensure that building toolchains specific to your OS version are installed. For example, GNU Compiler Collection (GCC), GNU make, or any other related packages.
-
Run the following commands to install Balance:
make make install
This installs Balance at /usr/sbin/ and the man page at /usr/man/man1.
-
Enable Balance to bind on port 445 of the local IPv4 IP address
and distribute connections to <host1_IP>, port 445, and
<host2_IP>, port 445.
#balance -fb ::ffff:<IP> 445 <host1_IP>:445 % <host2_IP>:445
where <IP> is the local IPv4 IP address, <host1_IP> is the IPv4 address of the first server hostname, and <host2_IP> is the IPv4 address of the second server hostname.
-
Download Balance from the Balance download page.
-
Configure HAProxy.
-
To configure HAProxy on Solaris 11.2, download the appropriate version of HAProxy in accordance to
your server (x86 or Sparc).
For example, haproxy-1.4.18-pcre-solaris10-x86.stripped.gz.
-
Get Perl Compatible Regular Expressions (PCRE) and its dependencies from http://www.pcre.org/.
- Unzip the PCRE
library.
gunzip prce-x.x.tar.gz tar xf prce-x-x.tar cd prce-x.x
- Run the following
commands:
./configure --enable-static --enable-shared --prefix=/usr/local--enable-unicode-properties make && make install
- Unzip the PCRE
library.
- Create a new user and group with name haproxy.
-
Run the following commands:
gunzip haproxy-1.4.x-pcre-solaris10-x86.stripped.gz mv haproxy-1.4.x-pcre-solaris10-x86.stripped haproxy mv haproxy /usr/bin/ chmod +x /usr/bin/haproxy mkdir -p /etc/haproxy
-
Create and edit the /etc/haproxy/haproxy.cfg configuration
file by adding the configuration shown below:
global log 127.0.0.1 local0 notice user haproxy group haproxy chroot /etc/haproxy #directory daemon nbproc 7 pidfile /var/run/haproxy.pid defaults log global option tcplog option redispatch contimeout 3000 clitimeout 5000 srvtimeout 5000 listen hostname <IP>:445 mode tcp balance roundrobin server hostname <host1_IP>:445 weight 77 server hostname <host2_IP>:445 weight 179
Note: Make sure you have /usr/bin in your environment path. -
Run HAProxy with the following command:
haproxy -f /etc/haproxy/haproxy.cfg -D
-
To configure HAProxy on Solaris 11.2, download the appropriate version of HAProxy in accordance to
your server (x86 or Sparc).
cifs.loadBalancerList = <IP address of the Load Balancer>