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萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章