1、 安装lvs和piranha:yum –yinstall piranha,会自动安装ipvsadm及相关依赖
2、 启动piranha:servicepiranha-gui start
Piranha配置界面,启动端口为3636
3、 为piranha设置密码(用户名是:piranha,密码也设置为piranha):piranha-passwd:
4、 配置lvs的从机:
Redundant server public IP //备份的ip
Heartbeat interval (seconds) //心跳间隔(秒)
Assume dead after (seconds) //多长时间确定死亡转移
Heartbeat runs on port //heartbeat运行的端口
5、 配置虚拟服务:
6、 启动lvs:servicepulse start
Lvs主机自动加上虚拟ip:ifconfig
7、 lvs服务器开启转发:
编辑/etc/sysctl.conf文件,把net.ipv4.ip_forward = 1改为1(支持转发),执行sysctl –p生效。
8、 为realserver配置虚拟ip,在/etc/sysconfig/network-scripts增加一块网卡:ifcfg-lo:0内容为:
9、 no-arp:
vi /etc/sysctl.conf
net.ipv4.conf.lo.arp_ignore = 1
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.all.arp_announce = 2
sysctl -p