Linux cluster lvs practice

Source: Internet
Author: User
Linux cluster lvs Linux cluster-LVS (DR) + HeartbeatLVS + HeartbeatLVS1 and LVS2 perform the same job, so the configuration script is the same. The only difference is that the heartbeat configuration file ha. cf has different heartbeat addresses. Real web, mysql, ftp & hellip; same configuration as LVS configuration #! /B... Linux cluster lvs Linux cluster-LVS (DR) + HeartbeatLVS + Heartbeat LVS1 and LVS2 perform the same job, so the configuration script is the same. The only difference is that the heartbeat configuration file ha. cf has different heartbeat addresses. Real web, mysql, ftp ...... Same configuration as LVS configuration #! /Bin/bash ###### lvs ###### ifconfig eth0: 0 222.90.88.88 broadcast 222.90.88.88 netmask merge route 255.255 up route add-host 222.90.88.88 dev eth0: 0 ipvsadm-C ipvsadm-A-t 222.90.88.88: 80-s rr ipvsadm-a-t ratio: 80-r 222.90.88.10-g ipvsadm-a-t 222.90.90.88.88: 80-r 222.90.88.20-g ingress sadmweb configuration #! /Bin/bash ###### real server ###### ifconfig lo: 0 222.90.88.88 broadcast 222.90.88.88 netmask resume 255.255.255 up route add-host 222.90.88.88 dev lo: 0 ####### ipvsadm ###### echo "1">/proc/sys/net/ipv4/conf/lo/arp_ignore echo "2">/proc /sys/net/ipv4/conf/lo/arp_announce echo "1">/proc/sys/net/ipv4/conf/all/arp_ignore echo "2">/proc/sys /net/ipv4/conf/all/arp_announce sysctl-p operation: four LINUX hosts (LVS1, L VS2 and SEV1, SEV2) LVS1 install heartbeat # rpm-ivh heartbeat-pils-2.1.3-3.el5.centos.i386.rpm # rpm-ivh heartbeat-stonith-2.1.3-3.el5.centos.i386.rpm # rpm-ivh heartbeat-2.1.3-3.el5.centos.i386.rpm # rpm-q heartbeat-d (unzip the file) # cd/usr/share/docheartbeat-2.1.3/# cp authkeys ha. cf haresources/etc/ha. d # cd/etc/ha. d # vim authkeys ...... Auth 1 1 crc ...... # Vim/haresources ...... Vip-server1 222.90.88.88 vip. sh (LVS1, vip. sh is stored in/etc/init. d [start at boot])... # Vim/ha. cf ....... Bcast eth0 # Linux (heartbeat detection Nic )....... Ucast eth0 222.90.88.40 (ping LVS2 )....... Node vip-server1 (LVS1 machine name) node vip-server2 (LVS2 machine name )....... # Chmod 600 authkeys # vim/etc/init. d/vip. sh #! /Bin/sh ifconfig eth0: 0 222.90.88.88 broadcast 222.90.88.88 netmask 255.255.255 up route add-host 222.90.88.88 dev eth0: 0 ####### setup ipvs ##### ipvsadm-C ipvsadm-A-t 222.90.88.88: 80-s rr ipvsadm-a-t 222.90.88.88: 80-r 222.90.88.10-g ipvsadm-a-t 222.90.88.88: 80-r 222.90.88.20-g ipvsadm # chmod 777 vip. sh #/etc/init. d/vip. sh LVS2 install heartbeat # rpm-ivh heartbeat-pils-2.1.3-3.el5.centos. I386.rpm # rpm-ivh heartbeat-stonith-2.1.3-3.el5.centos.i386.rpm # rpm-ivh heartbeat-2.1.3-3.el5.centos.i386.rpm # rpm-q heartbeat-d (unzip the file) # cd/usr/share/docheartbeat-2.1.3/# cp authkeys ha. cf haresources/etc/ha. d # cd/etc/ha. d # vim authkeys ...... Auth 1 1 crc ...... # Vim/haresources ...... Vip-server1 222.90.88.88 vip. sh (LVS1, vip. sh is stored in/etc/init. d [start at boot])... # Vim/ha. cf ....... Bcast eth0 # Linux (heartbeat detection Nic )....... Ucast eth0 222.90.88.30 (ping LVS1 )....... Node vip-server1 (LVS1 machine name) node vip-server2 (LVS2 machine name )....... # Chmod 600 authkeys # vim/etc/init. d/vip. sh #! /Bin/sh ifconfig eth0: 0 222.90.88.88 broadcast 222.90.88.88 netmask 255.255.255 up route add-host 222.90.88.88 dev eth0: 0 ####### setup ipvs ##### ipvsadm-C ipvsadm-A-t 222.90.88.88: 80-s rr ipvsadm-a-t 222.90.88.88: 80-r 222.90.88.10-g ipvsadm-a-t 222.90.88.88: 80-r 222.90.88.20-g ipvsadm # chmod 777 vip. sh #/etc/init. d/vip. sh SER1 operation # vim/etc/init. d/lvs. sh #! /Bin/sh ###### realserver ###### ifconfig lo: 0 222.90.88.88 broadcast 222.90.88.88 netmask resume 255.255.255 up route add-host 222.90.88.88 dev lo: 0 echo "1">/proc/sys/net/ipv4/conf/lo/arp_ignore echo "2">/proc/sys/net/ipv4/conf/lo/arp_announce echo "1">/proc/sys/net/ipv4/conf/all/arp_ignore echo "2">/proc/sys/net/ipv4/conf/all/arp_announce sysctl-p # vim/var/www/html/index.html this is SER1 # Service httpd start SER2 operation # vim/etc/init. d/lvs. sh #! /Bin/sh ###### realserver ###### ifconfig lo: 0 222.90.88.88 broadcast 222.90.88.88 netmask resume 255.255.255 up route add-host 222.90.88.88 dev lo: 0 echo "1">/proc/sys/net/ipv4/conf/lo/arp_ignore echo "2">/proc/sys/net/ipv4/conf/lo/arp_announce echo "1">/proc/sys/net/ipv4/conf/all/arp_ignore echo "2">/proc/sys/net/ipv4/conf/all/arp_announce sysctl-p # vim/var/www/html/index.html this is SER2 # service httpd start test fault status LVS2heartbeat stop, LVS1 normal; SER1, SER2 normal LVS1 heartbeat stop, LVS2 normal; SER1, SER2 normal LVS1 normal, LVS2 normal; SER1 abnormal, SER2 normal LVS1 normal, LVS2 normal; SER1 normal, SER2 abnormal

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.