Heartbeat + LVS build a high-availability server Load balancer Cluster

Source: Internet
Author: User

Heartbeat + LVS build a high-availability server Load balancer Cluster

1. Introduction to heartbeat:

The Heartbeat project is an integral part of the Linux-HA project, which implements a high-availability cluster system. Heartbeat service and cluster communication are two key components of a highly available cluster. In the heartbeat project, the Heartbeat module implements these two functions.

This cluster solution is built using third-party software, which is simpler than the built-in cluster software of RedHat, but it is very convenient to build. It is also a fast solution.

The high-availability cluster of heartbeat adopts udp protocol and serial port communication, and heartbeat plug-in technology realizes serial port, multicast, broadcast, and multicast communication between clusters. The Heartbeat software is installed on two servers at the same time to monitor the system status, coordinate the work of the master and slave servers, and maintain the system availability. It can detect faults in system software and hardware at the server application level, and timely isolate and recover errors; through system monitoring, service monitoring, automatic IP migration, and other technologies, we can ensure the continuous high availability of important services in a simple and economical manner without spof throughout the application. Heartbeat uses the virtual IP address ing technology to implement the function of transparent switching between master and slave servers to the client.

However, a single heartbeat cannot provide robust services, so we use lvs in the background for load balancing.

2. LVS Introduction

LVS is short for Linux Virtual Server, which is a Virtual Server cluster system. Founded by Dr. Zhang Wenyu.

IPVS

Speaking of lvs, we should mention ipvs. IPVS is the core software of The LVS cluster system. Its main function is to install it on Load Balancer, forward requests sent to the Virtual IP address to the Real Server. IPVS has three load balancing mechanisms. The IP Tunneling mechanism is used here:

  • Virtual Server via NAT
  • Virtual Server via IP Tunneling
  • Virtual Server via Direct Routing

This experiment uses the last direct connection method.

Lvs scheduling algorithms are very important and you must be familiar with them. Have a detailed explanation on the official website: http://zh.linuxvirtualserver.org/

There are 10 Load Scheduling Algorithms for IPVS:

  1. Round Robin)
  2. Weighted Round call (Weighted Round Robin)
  3. Least Link (Least Connections)
  4. Weighted Least Connections)
  5. Locality-Based Least Connections)
  6. Locality-Based Least Connections with Replication)
  7. Destination Hashing)
  8. Source Hashing)
  9. Shortest Expected Delay)
  10. No Queue waiting (Never Queue)

Note: We use a simple call method.

3. ldirectord introduction:

Ldirectord works with lvs as a health check mechanism, or the Server Load balancer still has no detection function after the node fails.

The basic concepts of heardbeat, lvs, and ldirectord are introduced above. It is better to set up a service to show you the effect.

4. Set up the RHEL6.5 + LVS + Linux-HA + Ldirectord Service (provides http and ftp services as an example)

-------------------------------------- Split line --------------------------------------

Hot Standby for Web Services Based on Heartbeat V1

Heartbeat enables high-availability clusters of Web Services

Heartbeat + LVS + Ldirectord high-availability Load Balancing Solution

DRBD + Heartbeat + NFS High Availability Configuration notes

Heartbeat high availability for MySQL using NFS based on CRM

Heartbeat high-availability httpd simple configuration based on Resources

-------------------------------------- Split line --------------------------------------

Note:

1. System: redhat6.5;

2. nodes: a total of four virtual machines are used as nodes. Two of them are installed with heartbeat and lvs, and the other two nodes only provide apache and vsftpd services;

3. The resolution between the four nodes must be well done;

4. Firewall is disabled and time synchronization is performed. The system versions of the four hosts should be the same.

As shown in the experiment environment, the first console is my real machine, the other four are the four nodes of the experiment, the first two install heartbeat and lvs, and the last two consoles provide apache and vsftpd services. Next we will configure it in parts.

1. Install heartbeat:

This is a third-party software, not a redhat package, so you need to download it yourself:, respectively:

Heartbeat-3.0.4-2.el6.x86_64.rpm

Heartbeat-devel-3.0.4-2.el6.x86_64.rpm

Heartbeat-libs-3.0.4-2.el6.x86_64.rpm

I have a vsftpd service on my local machine. You can also find it at http://rpm.pbone.net.

Both nodes should have these three packages. Then install them in a custom location:

If the installation is not successful, you must reset your yum Source:

Vim/etc/yum. repos. d/yum. repo

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.