Going hand in hand with high availability (HA) is the load balancing technique. Two servers srv-1 and srv-2 to be added to the network topology

The omarine server running keepalived acts as a virtual server that distributes connections equally to the real servers srv-1 and srv-2. All service access to the virtual server is routed to real servers. Real servers are health checked to monitor the health of the network. A quorum is set (required minimum total weight of all live servers in the pool). If a real server has problem and the quorum is below the minimum, then access goes to a sorry server. In this example we create a virtual Web service. The contents of the server’s homepage are as follows:
• Real server srv-1: Hello, I am server 1.
• Real server srv-2: Hello, I am server 2.
• The sorry server: Sorry, the quorum was not achieved!
The quorum is set to 2. At startup both real servers are healthy and the quorum is sufficient. From the client we go to http://omarine.omarine.co several times, the connections go to srv-1 and srv-2 in turn equally. Then we stop the service on the srv-1. At this point the quorum is not reached and we are redirected to the home page of the sorry server at omarine

The configuration file is as follows:
global_defs {
notification_email {
tuyen
}
smtp_server 192.168.0.3 25
smtp_alert yes
smtp_alert_checker yes
max_auto_priority 99
lvs_flush
}
virtual_server_group G1 {
192.168.0.3 80
}
virtual_server group G1 {
lvs_sched rr
lvs_method NAT
protocol TCP
virtualhost omarine
quorum 2
sorry_server 192.168.0.3 80
sorry_server_lvs_method DR
inhibit_on_failure
real_server 192.168.0.4 80 {
weight 1
HTTP_GET {
url {
path /
digest 22f5bb897b25dabd36e19c2f20439ff7
}
}
}
real_server 192.168.0.5 80 {
weight 1
HTTP_GET {
url {
path /manual/
digest e073a410a4ef34b0adc28d280b019383
}
}
}
}
Notifications about the virtual service and the health of real servers are emailed to tuyen@omarine.omarine.co

In message 3, the real server srv-1 was stopped, so the message reported the failure status of srv-1 (192.168.0.4). In message 4, the server srv-1 was reactived and the HTTP_GET checking was successful. The last message, number 5, which is a report about the virtual server, it had sufficient quorum and returned to the normal service status.