您好,登錄后才能下訂單哦!
本篇內(nèi)容主要講解“centos7上keepalived的安裝和配置方法”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“centos7上keepalived的安裝和配置方法”吧!
1、環(huán)境規(guī)劃
1)master:node1,centos7.5,eth0:192.168.1.11,eht1:10.10.1.11,keepalive
2)backup:node1,centos7.5,eth0:192.168.1.12,eth2:10.10.1.12,keepalive
2、搭建步驟
1)node1,node2上都以mini方式安裝CentOS 7.5 64-bit,并按照規(guī)劃配置IP地址;
2)node1,node2的/etc/hosts中添加如下內(nèi)容。
192.168.1.11 node1.xx.xxx.com node1
10.10.1.11 node1.xx.xxx.com node1
192.168.1.12 node2.xx.xxx.com node2
10.10.1.12 node2.xx.xxx.com node2
3)node1,node2安裝keepalive1.3.5
#yum install keeplived
4)配置node1上的keepalive
vi /etc/keepalived/keepalived.conf #進(jìn)行如下修改
vrrp_instance VI_1 {
state MASTER #設(shè)置節(jié)點(diǎn)node1為MASTER角色
interface enp11s0f0 #配置eth0網(wǎng)卡enp11s0f0為節(jié)點(diǎn)node1的系統(tǒng)IP
virtual_router_id 51 #master和backup一致
priority 100 #數(shù)字越大,等級越高,保證master比任何backup高
advert_int 1
authentication {
auth_type PASS #vrrp協(xié)議,保證master及其他backup一致
auth_pass 1111 #保證master及其他backup一致
}
virtual_ipaddress {
192.168.1.210/24 #VIP
}
5)配置節(jié)點(diǎn)node2上的keeplive
vi /etc/keepalived/keepalived.conf #進(jìn)行如下修改
vrrp_instance VI_1 {
state BACKUP #設(shè)置節(jié)點(diǎn)node2為BACKUP角色
interface enp11s0f0 #配置eth0網(wǎng)卡enp11s0f0為節(jié)點(diǎn)node2的系統(tǒng)IP
virtual_router_id 51 #master和backup一致
priority 99 #數(shù)字越大,等級越高,保證比master低
advert_int 1
authentication {
auth_type PASS #vrrp協(xié)議,保證master及其他backup一致
auth_pass 1111 #保證master及其他backup一致
}
virtual_ipaddress {
192.168.1.210/24 #VIP
}
6)啟動和配置keepalive
systemctl start keepalived.service
systemct enable keepalived.service
3、驗(yàn)證
1)查看master上keepalive及ip
ps -ef|grep keepalive
ip addr
2)keepalived高可用測試
#關(guān)閉node1上的keepalived
systemctl stop keepalived.service
#查看node1上的keepalived和ip
ps -ef|grep keepalived
ip addr
#查看node2上的keepalived和ip
ps -ef|grep keepalived
ip addr
到此,相信大家對“centos7上keepalived的安裝和配置方法”有了更深的了解,不妨來實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。