Keepalived雙機熱備

2021-09-07 14:25:47 字數 1695 閱讀 2784

準備兩台虛擬機器

192.168.80.100 主伺服器

192.168.80.102 備份伺服器

在80.100虛擬機器上

systemctl stop firewalld //關閉防火牆

setenforce 0 //關閉selinux

1、 keepalived軟體安裝

yum install keepalived -y

/etc/keepalived/keepalived.conf #keepalived服務主配置檔案

/etc/rc.d/init.d/keepalived #服務啟動指令碼

2、配置檔案說明

1-13行表示全域性配置

global_defs

notification_email_from [email protected] #定義傳送郵件的位址

smtp_server 192.168.200.1 #郵箱伺服器

smtp_connect_timeout 30 #定義超時時間

router_id lvs_devel #定義路由標識資訊,相同區域網唯一

}15-30行 虛擬ip配置 brrp

keepalived熱備份(雙機熱備)

主keepalived伺服器:192.168.80.100

備keepalived伺服器:192.168.80.102

將裡面的內容全部刪除

更改為如下:

! configuration file for keepalived

global_defs

vrrp_instance vi_1

virtual_ipaddress

}

儲存退出

systemctl start keepalived //啟動keepalived

systemctl status keepalived //檢視狀態

ip addr show ens32 //檢視ens32網絡卡

在192.168.80.102的虛擬機上安裝keepalived

yum install keepalived -y

vi /etc/keepalived/keepalived.conf //keepalived服務主配置檔案

將裡面的內容全部刪除

更改為如下:

!onfiguration file for keepalived

global_defs

vrrp_instance vi_1

virtual_ipaddress

}

service keepalived start //啟動keepalived

service keepalived stop //關閉80.100主配置檔案keepalived

ip addr show ens32 //檢視ens32網絡卡

然後去80.102檢視

配置keepalived 雙機熱備

配置keepalived 雙機熱備 mkdir usr local keepalived tar zxvf keepalived 2.0.6.tar.gz c usr local keepalived cd usr local keepalived keepalived 2.0.6 configur...

Keepalived做雙機熱備

解壓以及編譯 tar xzf keepalived 1.2.7.tar.gz configure prefix opt keepalived make make install 配置keepalived 建立keepalived配置檔案keepalived.conf 只有虛擬ip功能,其他功能,例如...

Keepalived實現雙機熱備

一 主機從機都安裝keepalived 1.安裝 yum install y keepalived 2.備份 cd etc keepalived cp keepalived.conf keepalived.conf.back 二 主機配置並啟動 1.建立配置檔案 echo configuration...