LVS Load Balancing cluster + NAS shared storage service

Source: Internet
Author: User
Tags node server

LVS-DR direct connection routing mode + NAS storage sharing

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/053FV109-0.jpg "title =" 54.jpg" alt = "161926991.jpg"/>

Tutorial steps:

LVS Scheduler configuration: 1) Modify interface eth0: 0 2) Modify kernel sysctl. conf 3) install ipvsadm and Configuration

Web service configuration: 1) modify the loopback interface lo: 0 2) modify the kernel 3) Install WEB

I,LVS-DRDirect Connection routing Mode
1.Configure the load Scheduler
1) configure the virtual Ip Address
Note: Use the Virtual Interface Method eth0: 0) bind the network adapter eth0 to the VIP address to respond to the cluster mode.
Configuration result: eth0172.16.16.173/24 eth0: 0 172.16.16.172/24
[Root @ localhost ~] # Cd/etc/sysconfig/network-scripts
[Root @ localhost ~] # Cp ifcfg-eth0 ifcfg-eth0: 0
[Root @ localhost ~] # Vim ifcfg-eth0: 0.
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/053FR606-1.jpg "title =" 1.jpg" alt = "162031257.jpg"/>

[Root @ localhost ~] # Ifup eth0: 0
2). Adjust/proc response parameters
Note: To avoid exceptions in ARP resolution in the network, you should disable the redirection parameter response of the Linux kernel.
[Root @ localhost ~] # Vim/etc/sysctl. conf
Add the following parameters:
Net. ipv4.conf. all. send_redirects = 0
Net. ipv4.conf. default. send_redirects = 0
Net. ipv4.conf. eth0.send _ redirects = 0
Net. ipv4.conf. eth1.send _ redirects = 0 // You can omit the eth1 Nic if it does not exist.
[Root @ localhost ~] # Sysctl-p
[Root @ localhost ~] # Modprobe ip_vs
3) configure the load distribution policy ipvsadm Policy)
[Root @ localhost ~] # Rpm-ivh/misc/cd/Server/ipvsadm-2.0 .. rpm // install the ipvsadm package
[Root @ localhost ~] # Ipvsadm-A-t 172.16.16.172: 80-s rr
[Root @ localhost ~] # Ipvsadm-a-t 172.16.16.172: 80-r 172.16.16.177-g
[Root @ localhost ~] # Ipvsadm-a-t 172.16.16.172: 80-r 172.16.16.178-g
[Root @ localhost ~] # Service ipvsadm save // save Policy
[Root @ localhost ~] # Chkconfig ipvsadm on
3.Configure a node Server
1) configure the virtual IP address VIP )(WEB1)
Note: On each node server, a virtual ip address of 172.16.16.172 is also required for sending web responses only.
The source address of the data packet and does not need to listen to the client's access requests. Therefore, the Virtual Interface lo: 0 is used.
To host vip virtual ip172.16.16.172 and add a route record for the local machine.
[Root @ localhost ~] # Cd/etc/sysconfig/network-scripts/
[Root @ localhost ~] # Cp/ifcfg-lo: 0
[Root @ localhost ~] # Vim ifcfg-lo: 0
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/053FUP0-2.jpg "title =" 2.jpg" alt = "162057878.jpg"/> [root @ localhost ~] # Ifup lo: 0
[Root @ localhost ~] # Vim/etc/rc. local
/Sbin/route add-host 172.16.16.172 dev lo: 0 // add a route
[Root @ localhost ~] # Route add-host 172.16.16.172 dev lo: 0
2) adjust/porc response parameters
[Root @ localhost ~] # Vim/etc/sysctl. conf
Add the following parameters:
Net. ipv4.conf. all. arp_ignore = 1
Net. ipv4.conf. all. arp_announce = 2
Net. ipv4.conf. default. arp_ignore = 1
Net. ipv4.conf. default. arp_announce = 2
Net. ipv4.conf. lo. arp_ignore = 1
Net. ipv4.conf. lo. arp_announce = 2
[Root @ localhost ~] # Sysctl-p
3) install httpd and create a webpage
[Root @ localhost ~] # Yum-y install httpd
[Root @ localhost ~] # Echo 16.177>/var/www/html/index.html
[Root @ localhost ~] # Service httpd start
[Root @ localhost ~] # Chkconfig httpd on
1) configure the virtual IP address (WEB2)
Note: On each node server, a virtual ip address of 172.16.16.172 is also required for sending web responses only.
The source address of the data packet and does not need to listen to the client's access requests. Therefore, the Virtual Interface lo: 0 is used.
To host vip virtual ip172.16.16.172 and add a route record for the local machine.
[Root @ localhost ~] # Cd/etc/sysconfig/network-scripts/
[Root @ localhost ~] # Cp/ifcfg-lo: 0
[Root @ localhost ~] # Vim ifcfg-lo: 0
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/053FW358-3.jpg "title =" 2.jpg" alt = "162200986.jpg"/>

[Root @ localhost ~] # Ifup lo: 0
[Root @ localhost ~] # Vim/etc/rc. local
/Sbin/route add-host 172.16.16.172 dev lo: 0 // add a route
[Root @ localhost ~] # Route add-host 172.16.16.172 dev lo: 0
2) adjust/porc response parameters
[Root @ localhost ~] # Vim/etc/sysctl. conf
Add the following parameters:
Net. ipv4.conf. all. arp_ignore = 1
Net. ipv4.conf. all. arp_announce = 2
Net. ipv4.conf. default. arp_ignore = 1
Net. ipv4.conf. default. arp_announce = 2
Net. ipv4.conf. lo. arp_ignore = 1
Net. ipv4.conf. lo. arp_announce = 2
[Root @ localhost ~] # Sysctl-p
3) install httpd and create a webpage
[Root @ localhost ~] # Yum-y install httpd
[Root @ localhost ~] # Echo 16.178>/var/www/html/index.html
[Root @ localhost ~] # Service httpd start
[Root @ localhost ~] # Chkconfig httpd on

II,NASShared storage server configuration
1.Use NASPublish shared resources
1) install the nfs-utils oprtmap package (rpcbind is installed on the system after 6.0)
[Root @ localhost ~] # Yum-y install nfs-utils portmap
[Root @ localhost ~] # Chkconfig nfs on
[Root @ localhost ~] # Chkconfig portmap on
2) set the shared directory
[Root @ localhost ~] # Mkdir-p/opt/wwwroot
[Root @ localhost ~] # Vim/etc/exports
/Opt/wwwroot 192.168.1.0/24 (rw, sync, no_root_squash) // share the Directory
Note: If a directory is assigned to different clients and different permissions are assigned, perform the following operations::
[Root @ localhost ~] # Vim/etc/exports
/Var/ftp/pub 192.168.1.40 (ro) 192.168.1.20 (rw)
3) Start the NFS service program
[Root @ localhost ~] # Servi ce nfs start
[Root @ localhost ~] # Service portmap start
[Root @ localhost ~] # Showmount-e // view the NFS shared directory released by the Local Machine
2.Access NFS in the clientShared resources
1) install the portmap package
[Root @ localhost ~] # Yum-y install portmap
[Root @ localhost ~] # Chkconfig portmap on
[Root @ localhost ~] # Service portmap start
2) manually mount the NFS shared directory
[Root @ localhost ~] # Mount 192.168.1.1:/opt/wwwroot/var/www/html
3) automatic mounting
[Root @ localhost ~] # Vim/etc/fstab
192.168.1.1:/opt/wwwroot nfs/var/www/html defaults, _ netdev 0 0


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.