系统: redhat 6.5 mini
机器名
ip
vip
gw
lvs01(主lvs)
192.168.10.10(外网)
192.168.20.10(内网)
192.168.10.254
lvs02(备lvs)
192.168.20.10(外网)
192.168.20.20(内网)
192.168.10.254
rs01 (web)
192.168.20.100
192.168.20.254
192.168.20.254
rs02 (web)
192.168.20.200
192.168.20.254
192.168.20.254
1、 在各个机器上配置ip地址,机器名,关闭selinux,同步时间
[root@lvs01 ~]# hostname
lvs01
[root@lvs01 ~]# getenforce
Disabled
[root@lvs02 ~]# hostname
lvs02
[root@lvs02 ~]# getenforce
Disabled
[root@rs01 ~]# hostname
rs01
[root@rs01 ~]# getenforce
Disabled
[root@rs02 ~]# hostname
rs02
[root@rs02 ~]# getenforce
Disabled
[root@lvs01 yum.repos.d]# cat /etc/hosts
192.168.20.10 lvs01
192.168.20.20 lvs02
192.168.20.100 rs01
192.168.20.200 rs02
[root@lvs01 yum.repos.d]# ntpdate 0.rhel.pool.ntp.org
[root@lvs02 yum.repos.d]# ntpdate 0.rhel.pool.ntp.org
[root@rs01 yum.repos.d]# ntpdate 0.rhel.pool.ntp.org
[root@rs02 yum.repos.d]# ntpdate 0.rhel.pool.ntp.org
2、 在各个机器关闭防火墙,配置yum源
[root@lvs01 yum.repos.d]# service iptables stop
[root@lvs01 yum.repos.d]# chkconfig iptables off
[root@lvs02 ~]# service iptables stop
[root@lvs02 ~]# chkconfig iptables off
[root@rs01 ~]# service iptables stop
[root@rs01 ~]# chkconfig iptables off
[root@rs02 ~]# service iptables stop
[root@rs02 ~]# chkconfig iptables off
[root@lvs01 yum.repos.d]# service iptables stop
[root@lvs01 yum.repos.d]# chkconfig iptables off
[root@lvs01 yum.repos.d]# cat rhel-source.repo
[base]
name=base
baseurl=file:///mnt
enabled=1
gpgcheck=0
[LB]
name=LB
baseurl=file:///mnt/LoadBalancer
enabled=1
gpgcheck=0
[HA]
name=HA
baseurl=file:///mnt/HighAvailability
enabled=1
gpgcheck=0
[RS]
name=RS
baseurl=file:///mnt/ResilientStorage
enabled=1
gpgcheck=0
[root@lvs01 yum.repos.d]# scp rhel-source.repo lvs02:/etc/yum.repos.d/rhel-source.repo
3、 在rs01.rs02上部署web服务
[root@rs01 ~]# yum install -y httpd
[root@rs01 ~]# echo "rs01">/var/www/html/index.html
[root@rs01 ~]# service httpd restart
[root@rs01 ~]# chkconfig httpd on
[root@rs02 ~]# yum install -y httpd
[root@rs02 ~]# echo "rs02">/var/www/html/index.html
[root@rs02 ~]# service httpd restart
[root@rs02 ~]# chkconfig httpd on
4、 在lvs01,lvs02安装LB,开启路由转发功能,在lvs01上配置lvs集群登录用户和密码
[root@lvs01 yum.repos.d]# yum groupinstall "Load Balancer"
[root@lvs02 yum.repos.d]# yum groupinstall "Load Balancer"
[root@lvs01 yum.repos.d]# vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
[root@lvs01 yum.repos.d]# sysctl –p
[root@lvs02 yum.repos.d]# vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
[root@lvs02 yum.repos.d]# sysctl –p
[root@lvs01 yum.repos.d]# piranha-passwd
New Password:
Verify:
Adding password for user piranha
[root@lvs01 yum.repos.d]# /etc/init.d/piranha-gui start
[root@lvs01 yum.repos.d]# chkconfig piranha-gui on
5、 通过浏览器来配置lvs集群
5.1 在浏览器输入:3636,点击login,输入用户名和密码
5.2 配置lvs01,选择nat 模式,最后点击accept
5.3 配置lvs02的ip,先点击ENABLE,配置ip 后,最后点击accept确定
5.4 配置对外的服务,点击add->edit->accept