本篇內(nèi)容主要講解“centos7上keepalived的安裝和配置方法”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“centos7上keepalived的安裝和配置方法”吧!
創(chuàng)新互聯(lián)從2013年創(chuàng)立,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目成都網(wǎng)站建設(shè)、網(wǎng)站建設(shè)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個夢想脫穎而出為使命,1280元盧氏做網(wǎng)站,已為上家服務(wù),為盧氏各地企業(yè)和個人服務(wù),聯(lián)系電話:18982081108
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í)際操作一番吧!這里是創(chuàng)新互聯(lián)網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!