How to achieve Cluster load balancing on Redhat Linux

Source: Internet
Author: User
Tags ftp site
1. Preface
Let's briefly talk about the Server Load balancer cluster. It provides scalable and high-load server groups by multiple nodes in the case of high load of application servers to ensure good external service response; LVS is the technology that implements this function. It enables Kernel support for ipvs to implement LVS/direct routing (DR), LVS/IP tunnel, LVS/NAT functions. As the focus of this Article is on how to use LVS to build a Server Load balancer cluster, the details about the Server Load balancer cluster and LVS are not described here. If you are interested, refer to the following information:
Http://www.linuxvirtualserver.org/LVS Official Website
Introduction to http://www-900.ibm.com/developerWorks/cn/linux/cluster/lvs/part1/index.shtml LVS Project

RedHat 7.3/8.0 pre-compiled ipvs into the kernel of the RedHat release, but the lower version of ipvs used is ipvs 0.9.7/1.0.4, starting from RedHat 9, ipvs is no longer pre-compiled into the RedHat release kernel, this article describes how to compile the latest version of ipvs version 1.0.9 into the kernel and how to configure the Server Load balancer cluster.
Regardless of which version of RedHat Linux is used to install ipvs, the work can be divided into the following steps:

Figure 1 shows the simplest network topology of the Server Load balancer cluster. It is worth noting that the above mentioned installation of ipvs/ipvsadm is performed on director.


2. Implement ipvs on Redhat Linux 
The ipvs patch has been installed in RedHat 7.3/8.0. In the pre-installed kernel, ipvs has been compiled into a module, if you can see the ip_vs _ * file in the/lib/modules/2.4.18-*/kernel/NET/IPv4/ipvs directory, your system supports ipvs, follow these steps to install ipvsadm and configure the forwarding mode.


However, the system pre-compiled ipvs is a relatively early version (version 0.9.7/1.0.4). This article upgrades it to the latest version 1.0.9.

2.1 obtain the kernel source code and related software packages

It should be emphasized that because the kernel source code of RedHat 7.3/8.0 has already been patched with ipvs in advance, you cannot use the kernel source in the RedHat disc when installing ipvs, instead, you need to download the standard kernel. For RedHat 9.0, although the kernel does not pre-compile ipvs, I still advocate the use of standard kernel, because all the patch packages of ipvs are developed for the standard kernel. Get standard kernel linux-2.4.18.tar.gz (RedHat 7.3/8.0), linux-2.4.20.tar.gz (RedHat 9.0) from kernel FTP site, from LVS homepage to ipvs-1.0.9.tar.gz?#sadm-1.21.tar.gz. (In the following illustration, the internal linux-2.4.18.tar.gzis used as an example, and the internal linux-2.4.20.tar.gz practices are exactly the same)

2.2 patch ipvs to kernel source code

Extract linux-2.4.18.tar.gz to the/usr/src directory and generate the/usr/src/Linux directory. If the/usr/src/linux-2.4.18 * directory is generated, establish a connection ln-s linux-2.4.18 * Linux under/usr/src, because the path to the specified kernel source in the MAKEFILE file in the ipvs-1.0.9 is by default: kernelsource =/usr/src/Linux (of course, if you directly modify the kernelsource value in makefile to direct it to the source code directory ).

Extract javass-1.0.9.tar.gz to a directory, such as/usr/src/source, generating the/usr/src/source/ipvs-1.0.9 directory; enter/usr/src/source/ipvs-1.0.9, run the following commands in sequence: Make patchkernel and make installsource. Load the patch of ipvs to the source of the kernel. Of course you can also use linux-2.4.20-javass-1.0.9.patch.gz to directly patch to the kernel, execute gzip-CD linux-2.4.20-ipvs-1.0.9.patch.gz in/usr/src, and then run patch-p1 in/usr/src/Linux <../linux-2.4.20-ipvs-1.0.9.patch

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.