Quản trị net diễn đàn chia sẻ thông tin các thủ thuật mạng, internet bảo mật thông tin dành cho giới IT VIệt hy vọng là nơi bổ ích cho cộng đồng

Quản trị net diễn đàn chia sẻ thông tin các thủ thuật mạng, internet bảo mật thông tin dành cho giới IT VIệt hy vọng là nơi bổ ích cho cộng đồng (http://quantrinet.com/forum/index.php)
-   Web Server Apache Loadbalancing, Cluster, Failover (http://quantrinet.com/forum/forumdisplay.php?f=336)
-   -   How to setup HAProxy with Keepalived (http://quantrinet.com/forum/showthread.php?t=9862)

hoctinhoc 07-09-2015 10:01 AM

How to setup HAProxy with Keepalived
 
How to setup HAProxy with Keepalived

Back once again it’s Linux time. This post also can be named as how to set up a floating IP between load balancers or how to set up a shared IP for between load balancers or how to configure a high available load-balancers. what happens here we are using keepalived, which allows us to setup HAProxy nodes to create active/passive cluster so that load can be divided amount node members. If the main HAProxy node goes down, the second one(slave node) will be elected as master node. We are getting it done using VRRP.
What & How VRRP Works

The VRRP protocol provides automatic assignment of available IP to participating hosts which ensures that one of participating nodes is master. The master and slave node acts as a group where the backup node listens for multicast packets from a node with a higher priority which could the master node. If the backup node fails to receive VRRP advertisements for a period of time longer than three times of the advertisement timer, the backup node takes the master state and assigns the configured shared/floating IP to itself. In case there are more than one backup nodes with the same priority, the one with the highest IP wins the election.
Keepalived is a routing software written in C. The main goal of this project is to provide simple and robust facilities for loadbalancing and high-availability to Linux system and Linux based infrastructures.
HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications. It is particularly suited for very high traffic web sites and powers quite a number of the world’s most visited ones.
Today what we are trying to implement the load balancer cluster as follows. It’ll be an active/passive load balancer cluster
http://dasunhegoda.com/wp-content/up...ed-Diagram.pngKeepalived & HAProxy Load Balancing


I’m using below IPs for explanation purposes.
  • Master node address: 192.168.6.169
  • Slave node address: 1192.168.6.170
  • Shared/Floating Virtual address: 192.168.6.164
Below mentioned is the two scenario that can occur within a active/passive load balancer cluster.
http://dasunhegoda.com/wp-content/up...015/03/lb1.pngMaster Load Balancer is Up. Usual Scenario

http://dasunhegoda.com/wp-content/up...015/03/lb2.pngMaster Load Balancer is Down. Slave Load Balancer Takes Over

Configuring HAProxy and Keepalived

1. Full: http://dasunhegoda.com/how-to-setup-haproxy-with-keepalived/833/


2. https://blog.logentries.com/2014/12/...oratory-guide/




:battay:


Bây giờ là 06:11 PM. Giờ GMT +7

Diễn đàn tin học QuantriNet
quantrinet.com | quantrimang.co.cc
Founded by Trương Văn Phương | Developed by QuantriNet's members.
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.