Keepalived高可用集群
keepalived高可用集群是指一個主服務器,一個備份服務器,共同使用一個虛擬的ip地址,當主服務器宕掉之后,備份服務器開始工作,這樣就避免了訪問事故。
搭建keepalived高可用集群
[master]
#yum -y install keepalived
#vim /etc/keepalived/keepalived.conf
vrrp_instance webha {
state MASTER 主服務器
interface eth0 網(wǎng)卡口
priority 130 優(yōu)先級
authentication {
auth_type PASS
auth_pass 123456 主、備密碼相同
}
virtual_ipaddress {
192.168.4.251 虛擬的網(wǎng)絡地址
}
}
#service keepalived start
#chkconfig keepalived on 開機自啟
#chkconfig --list | grep keepalived
#ip add show | grep 192.168.4 查看虛擬ip在哪臺服務器上
[slave]
#vim /etc/keepalived/keepalived.conf
vrrp_instance webha {
state SLAVE/BACKUP 備份服務器
interface eth0 網(wǎng)卡口
priority 130 優(yōu)先級
authentication {
auth_type PASS
auth_pass 123456 主、備密碼相同
}
virtual_ipaddress {
192.168.4.251 虛擬的網(wǎng)絡地址
}
}
#service keepalived start
#curl http://192.168.4.251
文章名稱:Keepalived高可用集群
地址分享:
http://weahome.cn/article/jsepid.html