Lvs+keepalived build a highly available load-balanced configuration

Source: Internet
Author: User
Tags linux

A brief introduction of LVS

LVS is the short name of Linux virtual server, the Linux VM, a free software project initiated by Dr. Zhangwensong, and its official site is www.linuxvirtualserver.org. Now LVS is already a part of the Linux standard kernel, in the Linux2.4 kernel before the use of LVS must recompile the kernel to support the LVS function module, but from the Linux2.4 kernel, has been completely built-in LVS of the various functional modules, no need to make any patches to the kernel, You can use the various functions provided by LVS directly. The goal of using LVS technology is to achieve a high-performance, highly available server cluster through LVS's load balancing technology and Linux operating system, which is reliable, scalable, and operable. In order to achieve the best service performance at low cost.

About the installation and introduction of LVS, in the previous article has been in-depth introduction, here no longer tell.

This article explains the following environment:

Operating system: Unified use of Centos5.3 version, address planning as follows:

Figure 1

The VIP in Figure 1 refers to the virtual IP address, also can be called LVS Cluster service IP, in the DR, Tun mode, the packet is returned directly to the user, so, on the Director server and on each node of the cluster need to set this address. This IP is typically bound on a loopback address, such as lo:0, on real server, and, similarly, on director server, virtual IP is bound on a true network interface device, such as eth0:0.

Each real server can be within the same network segment, it can be a separate network segment, or it can be multiple servers that are distributed across the Internet.

The lvs+keepalived high Availability load Balancing cluster topology is shown in Figure 2:

Figure 2

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Servers/virtualization/

Second, install keepalived

Keepalived was originally designed for LVS, specially used to monitor the status of each service node in the cluster system, and later added the VRRP function, VRRP is the abbreviation of Virtual Router redundancy Protocol. The purpose of VRRP is to solve the problem of single point fault in static routing, it can guarantee the uninterrupted and stable operation of the network. Therefore, keepalived on the one hand has the server health detection function, on the other hand also has the HA cluster function.

Keepalived's official site is http://www.keepalived.org, can download to various versions here, we download here is keepalived-1.1.19.tar.gz, installation steps are as follows:

[ROOT@DR1 ~] #tar zxvf keepalived-1.1.19.tar.gz

[ROOT@DR1 ~] #cd keepalived-1.1.19

[Root@dr1 keepalived-1.1.19]#./configure--sysconf=/etc \

>--with-kernel-dir=/usr/src/kernels/2.6.18-8.el5-i686

[Root@dr1 keepalived-1.1.19] #make

[ROOT@DR1 keepalived-1.1.19] #make Install

[Root@dr1 keepalived-1.1.19] #ln-S/usr/local/sbin/keepalived/sbin/

In the compilation options, "--sysconf" specifies the installation path for the keepalived configuration file, that is, the path is/etc/keepalived/keepalived.conf, and "--with-kernel-dir" is an important parameter. But this parameter is not to compile the keepalived into the kernel, but to specify the header file in the kernel source code, which is the include directory. If you want to use LVS, you need this parameter, otherwise it is not necessary.

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.