LVS+PIRANHA实现负载均衡

 

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

发布了110 篇原创文章 · 获赞 6 · 访问量 24万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章