Keepalived做雙機熱備

2021-09-20 17:04:14 字數 1172 閱讀 3691

解壓以及編譯

tar xzf keepalived-1.2.7.tar.gz

./configure --prefix=/opt/keepalived make && make install

配置keepalived

建立keepalived配置檔案keepalived.conf(只有虛擬ip功能,其他功能,例如監控服務、傳送郵件等功能由其他指令碼完成)

ps:網絡卡必須是內網網絡卡

主機配置

!  主機配置

vrrp_instance vi_1

virtual_ipaddress

}備機配置

! 備機配置

vrrp_instance vi_1

virtual_ipaddress

}啟動keepalived

將keepalived設定成為服務式啟動及停止

#!/bin/bash

my_root=$(cd "$(dirname "$0")"; pwd)

ln -s $my_root/sbin/keepalived /usr/sbin/keepalived

ln -s $my_root/etc/sysconfig/keepalived /etc/sysconfig/keepalived

ln -s $my_root/etc/rc.d/init.d/keepalived /etc/init.d/keepalived

mkdir /etc/keepalived

ln -s $my_root/keepalived.conf /etc/keepalived/keepalived.conf

啟動keepalived

/etc/init.d/keepalived start

可以tail系統日誌/var/log/messages來檢視服務啟動狀態

keepalived 的詳細介紹:請點這裡

:請點這裡

推薦閱讀:

centos 6.3下haproxy+keepalived+apache配置筆記 

haproxy + keepalived 實現web群集 on centos 6 

keepalived+haproxy配置高可用負載均衡 

haproxy+keepalived構建高可用負載均衡 

Keepalived雙機熱備

準備兩台虛擬機器 192.168.80.100 主伺服器 192.168.80.102 備份伺服器 在80.100虛擬機器上 systemctl stop firewalld 關閉防火牆 setenforce 0 關閉selinux 1 keepalived軟體安裝 yum install keep...

配置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實現雙機熱備

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