keepalived是一款用c寫的,為linux集群提供負載均衡和高可用的軟體.其中負載均衡功能封裝了lvs模組,而高可用功能則是採用了vrrp協議
在centos7上,keepalived的安裝可以採用rpm包和原始碼包兩種方式
]# yum install keepalived
]# yum install curl gcc openssl-devel libnl3-devel net-snmp-devel//編譯所需工具
]# wget
]# tar -zxvf keepalived-1.4
.2.tar.gz
]# cd keepalived-1.4
.2/]# ./configure --prefix=/usr/local/keepalived
]# make && make install
keepalived的配置檔案是keepalived.conf,預設位於/etc/keepalived目錄下(yum安裝)
]# cat /etc/keepalived/keepalived.conf
! configuration file for keepalived
global_defs
notification_email_from kaadmin@localhost
//傳送mail所用的位址
smtp_server 127.0.0.1//傳送mail所用的email伺服器
smtp_connect_timeout 30
router_id node1//本機id號,同vrrp組唯一
vrrp_skip_check_adv_addr
vrrp_garp_interval 0
vrrp_gna_interval 0
#vrrp_strict//預設啟用,會新增iptables規則導致vip無法訪問,因此關閉
vrrp_mcast_group4 224.10.0.200//vrrp組播位址,同vrrp組需一致(也可不寫)
}vrrp_script chk_schedown
vrrp_instance vi_1
virtual_ipaddress
track_script
notify_master "/etc/keepalived/notify.sh master"
//變為master狀態觸發
notify_backup "/etc/keepalived/notify.sh backup"
//變為backup狀態觸發
notify_fault "/etc/keepalived/notify.sh fault"
//預設觸發
}
]# cat notify.sh
#!/bin/bash
vip=192.168.10.200
contact='root@localhost'
notify
() case
"$1"
in master)
notify master
exit
0 ;;
backup)
notify backup
exit
0 ;;
fault)
notify fault
exit
0 ;;
*)echo
'usage: `basename $0` '
exit
1 ;;
esac
keepalived安裝使用
2.keepalived雙機主備配置 3.keepalived雙機熱備 4.將keepalived 註冊為系統服務 5.配置nginx自動重啟 6.整合fdfs yum y install libnl libnl develtar zxvf keepalived 2.0.18.tar.gz cd k...
Keepalived使用小結
編譯安裝 1 安裝環境 centos release 6.4 based on linux 2.6.32,安裝1.2.9,沒問題 在red hat enterprise linux server release 5.3 tikanga based on 2.6.18 安裝1.2.9,有問題,1.2....
Keepalived 使用指南
負載均衡是虛擬服務的一種好的處理方案。當設計一種負載均衡的拓撲時一定要考慮到如下兩點 真實伺服器的可用性使用健康檢測機制。負載均衡器的可用性使用故障轉移協議。負載均衡真實服務,提供了乙個全域性的高可用虛擬服務。為增加負載均衡服務的可用性,需要檢測每個真實伺服器節點的狀態。這個問題可以通過使用健康檢測...