DR configuration: LinuxVirtualServer Load Balancing
Source: Internet
Author: User
DR configuration: LinuxVirtualServer server Server Load balancer-Linux Enterprise Application-Linux server application information. For details, refer to the following section. 1. Install ipvsadm
When downloading ipvsadm, pay attention to the corresponding kernel version.
This document uses the FC8 system, kernel version 2.6.23.1, and ipvsadm version 1.24.
The Linux kernel source code is required during installation. if the system is not installed with the source code, you need to download the kernel source code. This document uses linux-2.6.23.1.tar.bz2. Unzip the kernel to/usr/src/linux-2.6.23.1. Compile and install the tool as follows:
The customer accesses the server through Virtual IP 192.168.34.41. Load Balancer distributes access requests from customers to the actual servers 192.168.34.26 and 192.168.34.27 based on a certain Load balancing mechanism.
2.2.Load Balancer Configuration
Step 1: Configure Director IP
Configure the eth0 IP address (192.168.34.40) on ctor, and add an IP address (192.168.34.41) on eth0, named eth0: 0 as the Virtual IP address.
Step 2: configure the IPVS Table script
Write the sh script as follows:
VIP = 192.168.34.41 # Vritual IP Address
RIP1 = 192.168.34.27 # Real Server 1 IP
RIP2 = 192.168.34.26 # Real Server 2 IP
GW = 192.168.34.1 # Real Server gateway IP Address
This script configures s Table and saves the configuration to the/etc/sysconfig/ipvsadm file. You can modify the ipvs table directly later. Of course, you can also directly edit the file to implement the s Table configuration.
After the configuration is complete, run/etc/rc. d/init. d/ipvsadm start (or service ipvsadm start) to start IPVS.
The slb ipvs configuration is completed through the above two steps.
2.3.Real Server Configuration
Real Server mainly implements two configurations: one is to add a virtual IP address and the other is to disable the ARP response of the IP address.
2.3.1.Windows
For a Windows server, you only need to add a Loopback Nic, set the IP address to a virtual IP address (192.168.34.41), set the subnet mask to 255.255.255.255, and leave the gateway address blank.
Operation:
Select Add hardware from the control panel;
Select "Yes, the hardware is connected ";
Select "Add new hardware device ";
Select "Install the hardware I manually selected from the list ";
Select "network adapter ";
Select Microsoft from the vendor list and Microsoft Loopback Adapter from the NIC list ";
Click Next to start hardware installation. After the installation is complete, a new Nic is displayed, and the IP address and subnet mask are configured. Windows subnet mask cannot be configured as 255.255.255.255. We can save the configuration by default and then modify the subnet mask from the registry.
Modify the subnet mask of the registry:
Find the corresponding Nic from the registry [HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ Tcpip \ Parameters \ Interfaces] and change SubnetMask to 255.255.255.255. Disable and enable the NIC.
2.3.2.Linux
3. Configure LDirectord RealServer fault detection and management
The LDirectord Process regularly checks the running status of each Real Server. When a Real Server fault is detected, the LDirectord Server is deleted from the Server Load balancer scheduling list and then added when it returns to normal.
3. 1. Install LDirectord
The LDirectord package is included in the HeartBeat package. LDirectord is installed at the same time when HeartBeat is installed.
After installation, run the following command to add the auto-start item:
Chkconfig? Add ldirectord
3. 2. Configure LDirectord
The heartbeat/ldirectord directory contains an ldirectord. cf file. This file is an example of ldirectord configuration.
Create an ldirectord. cf file in the/etc/ha. d/directory and configure it according to the configuration sample format. The main configuration items are as follows:
Checktimeout = 3 # detection timeout 3 s
Checkinterval = 1 # detection interval 1 s
Fallback = 127.0.0.1: 443 # access to this server when all servers fail
Autoreload = yes # automatically loaded when the configuration file changes
Logfile = "/var/log/ldirectord. log" # log File
Quiescent = yes
Virtual = 192.168.34.41: 443 # virtual IP
Real = 192.168.34.26: 443 gate
Real = 192.168.34.27: 443 gate
Fallback = 127.0.0.1: 443 # access to this server when all servers fail
Service = none
Schedlc = wlc
Perpersistent = 600
Protocol = tcp
Checktype = on
3. Start ldirectord
/Etc/rc. d/init. d ldirectord start
Note: if an error occurs in a line of ldirectord during startup, it is generally because some required software is not installed, most of which are software packages starting with perl.
Net-snmp-5.3-4.2.i386.rpm
Net-snmp-libs-5.3-4.2.i386.rpm
Perl-Compress-Zlib-1.41-1.2.2.i386.rpm
Perl-HTML-Parser-3.50-1.i386.rpm
Perl-HTML-Tagset-3.10-2.1.noarch.rpm
Perl-libwww-perl-5.805-1.1.noarch.rpm
Perl-MailTools-1.74-1.fc5.noarch.rpm
Perl-TimeDate-1.16-3.2.noarch.rpm
Linux perl-URI-1.35-2.2.noarch.rpm
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