企业Web高可用集群实战之LVS+Keepalived+MySQL HA(2)

2、在各web节点上创建realserver脚本

cat /root/sh/lvs_real.sh #!/bin/bash #Description: Config realserver script #Written by : opsren---- SNS_VIP=192.168.8.10 /etc/rc.d/init.d/functions   case "$1" in start)        /sbin/ifconfig lo:0 $SNS_VIP netmask 255.255.255.255 broadcast $SNS_VIP        /sbin/route add -host $SNS_VIP 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 >/dev/null 2>&1        echo "RealServer Start OK"          ;; stop)        /sbin/ifconfig lo:0 down        /sbin/route del $SNS_VIP >/dev/null 2>&1        echo "0" >/proc/sys/net/ipv4/conf/lo/arp_ignore        echo "0" >/proc/sys/net/ipv4/conf/lo/arp_announce        echo "0" >/proc/sys/net/ipv4/conf/all/arp_ignore        echo "0" >/proc/sys/net/ipv4/conf/all/arp_announce        echo "RealServer Stoped"        ;; *)        echo "Usage: $0 {start|stop}"        exit 1 esac   exit 0  给予可执行权限: chmod +755 /roo/sh/lvs_real.sh  启动脚本: /root/sh/lvs_real.sh start 

三、MySQL高可用(双主)部署

1.MySQL安装与配置

这里采用mysql5.5.24二进制tar包

tar zxf mysql-5.5.24-linux2.6-x86_64.tar.gz -C /usr/local/mysql5.5

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/d97f8152a936bfc51c890875a49d8fdc.html