piątek, 4 września 2015

Cluster HAProxy

Configuring HAProxy and Keepalived - HTTP

Install HAProxy and Keepalived on both ubuntu nodes.
Load balancing in HAProxy also requires the ability to bind to an IP address that are nonlocal, meaning that it is not assigned to a device on the local system. Below configuration is added so that floating/shared IP can be assigned to one of the load balancers. Below line get it done.
Now you know what’s happening with above lines let’s edit the sysctl.conf.
Add the below lines.
To enable the changes made in sysctl.conf you will need to run the command.

Now let’s create keepalived.conf file on each instances. All the below Keepalived configurations are explained in the User guide provided by Keepalived and refer this guide as well.
Add the below configuration on the master node

Add the below configuration on the slave node.
Restart Keepalived.
Now let’s configure HAProxy on both instances. You will have do the below steps on master node as well as slave node.
set the property ENABLED to 1.
Note that below configurations are as per my requirement.
If above configurations are not clear please refer this guide from HAProxy.

Testing

Let’s check whether our configuration has been done correctly. Try executing ip addr on master node. As you can see on the master node 192.168.6.164 IP is assigned.
Try executing ip addr on slave node.
Let stop the HAProxy on the master node. Now you can see that IP address 192.168.6.164 will be assigned to the salve node. If you start HAproxy instance on the master node IP address 192.168.6.164 will be assigned back to master node. See the O/P below.
Try http://192.168.6.169:8989/stats or http://192.168.6.170:8989/stats URL to login into statistics report for HAProxy.
Statistics Report for HAProxy
Statistics Report for HAProxy
If you have any questions let me know in the comments below. Your feedback is highly appreciated(happy-face). 

Brak komentarzy:

Prześlij komentarz