您好,登錄后才能下訂單哦!
本篇內容主要講解“centos7上keepalived的安裝和配置方法”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“centos7上keepalived的安裝和配置方法”吧!
1、環境規劃
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,并按照規劃配置IP地址;
2)node1,node2的/etc/hosts中添加如下內容。
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 #進行如下修改
vrrp_instance VI_1 {
state MASTER #設置節點node1為MASTER角色
interface enp11s0f0 #配置eth0網卡enp11s0f0為節點node1的系統IP
virtual_router_id 51 #master和backup一致
priority 100 #數字越大,等級越高,保證master比任何backup高
advert_int 1
authentication {
auth_type PASS #vrrp協議,保證master及其他backup一致
auth_pass 1111 #保證master及其他backup一致
}
virtual_ipaddress {
192.168.1.210/24 #VIP
}
5)配置節點node2上的keeplive
vi /etc/keepalived/keepalived.conf #進行如下修改
vrrp_instance VI_1 {
state BACKUP #設置節點node2為BACKUP角色
interface enp11s0f0 #配置eth0網卡enp11s0f0為節點node2的系統IP
virtual_router_id 51 #master和backup一致
priority 99 #數字越大,等級越高,保證比master低
advert_int 1
authentication {
auth_type PASS #vrrp協議,保證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、驗證
1)查看master上keepalive及ip
ps -ef|grep keepalive
ip addr
2)keepalived高可用測試
#關閉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的安裝和配置方法”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。