keepalived主備排程器的實現

2021-09-25 12:55:25 字數 2328 閱讀 2222

1、實驗原理:

在企業中,如果只有一台排程器,那麼如果它出現問題,將造成不可估量的損失,所以企業會使用兩台排程器,主排程器正常工作,如果出現問題那麼輔排程器接替它繼續工作,不會影響業務。

2、實驗環境

主和備兩台排程器要有所有主機的解析,包括自己

server1:主排程器 ip:172.25.1.101

server4:輔排程器 ip:172.25.1.103

server2:伺服器 ip:172.25.1.102

server3:伺服器 ip:172.25.1.103

測試機:172.25.1.1

3、配置

server1

tar -zxf keepalived-2.0.17.tar.gz

yum install gcc openssl-devel 安裝原始碼編譯所需要的環境

cd keepalived-2.0.17

./configure --prefix=/usr/local/keepalived --with-init=systemdls

make && make install

ln -s /usr/local/keepalived/etc/keepalived/ /etc/

/etc/init.d/ldirectord stop

chkconfig ldirectord off

cat /usr/lib/systemd/system/keeplived.service

vim /etc/keepalived/keepalived.conf

global_defs

notification_email_from keepalived@localhost

smtp_server 127.0.0.1

smtp_connect_timeout 30

router_id lvs_devel

vrrp_skip_check_adv_addr

#vrrp_strict

vrrp_garp_interval 0

vrrp_gna_interval 0

} vrrp_instance vi_1

virtual_ipaddress

} virtual_server 172.25.1.101 80

}real_server 172.25.1.103 80

}} systemctl start keepalived.service

server4

tar -zxf keepalived-2.0.17.tar.gz 

yum install gcc openssl-devel

cd keepalived-2.0.17

./configure --prefix=/usr/local/keepalived --with-init=systemdls

make && make install

ln -s /usr/local/keepalived/etc/keepalived/ /etc/

/etc/init.d/ldirectord stop

chkconfig ldirectord off

vim /etc/keepalived/keepalived.conf

vim /etc/keepalived/keepalived.conf

global_defs

notification_email_from keepalived@localhost

smtp_server 127.0.0.1

smtp_connect_timeout 30

router_id lvs_devel

vrrp_skip_check_adv_addr

#vrrp_strict

vrrp_garp_interval 0

vrrp_gna_interval 0

} vrrp_instance vi_1

virtual_ipaddress

} virtual_server 172.25.1.104 80

}real_server 172.25.1.103 80

}} systemctl start keepalived.service

server2,server3

systemctl start httpd
4、測試:

關掉主排程器

curl 172.25.1.101

配置 Keepalived 主備

1.通過命令vim keepalived.conf開啟配置檔案 global defs vrrp instance vi 1 虛擬出來的ip,可以有多個 vip virtual ipaddress 附 檢視網絡卡名稱 2.啟動 keepalived 在sbin目錄中進行啟動 同nginx 如下圖 3...

keepalived實現主備切換

wget tar zxvf keepalived 1.2.18 tar.gz c usr local yum install y openssl openssl devel cd keepalived 1.2.18 configure prefix usr local keepalived make...

Keepalived部署雙主熱備

二 配置keepalived主和從 2.2 配置keepalived 從 2.3 啟動keepalived 三 keepalived註冊為系統服務 四 keepalived配置nginx自動重啟 五 配置keepalived雙主熱備 上傳壓縮包 scp keppalived.tar.gz root ...