Centos6 5安裝配置keepalived

2021-07-05 06:18:21 字數 1843 閱讀 4148

首先檢查安裝openssl-devel

yum install openssl-devel

如果是離線,借鑑文章:

# ./configure --prefix=/usr/local/keepalived --with-kernel-dir=/usr/src/kernels/2.6.32-279.el6.x86_64

當出現如下字樣

keepalived configuration

------------------------

keepalived version       : 1.2.19

compiler                 : gcc

compiler flags           : -g -o2

extra lib                : -lssl -lcrypto -lcrypt

use ipvs framework       : yes

ipvs sync daemon support : yes

ipvs use libnl           : no

fwmark socket support    : yes

use vrrp framework       : yes

use vrrp vmac            : yes

snmp support             : no

sha1 support             : no

use debug flags          : no

執行安裝命令

# make 

# make install

設定keepalived開機啟動指令碼

cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/rc.d/init.d/

cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/

cp /usr/local/keepalived/sbin/keepalived /usr/sbin/

chkconfig keepalived on

新建乙個配置檔案,預設keepalived啟動會去/etc/keepalived目錄下尋找配置檔案

# mkdir /etc/keepalived

# vi /etc/keepalived/keepalived.conf

global_defs

notification_email_from root@localhost

smtp_server 127.0.0.1

smtp_connect_timeout 30

router_id lvs_devel }

vrrp_instance vi_1

virtual_ipaddress }

virtual_server 192.168.30.20 80 }

real_server 192.168.30.13 80 }

} 配置完成後啟動keepalived,

如果是要配置mysql ha,那麼需要在啟動mysql相關服務前,要啟動keepalived,否則將會無法連線到伺服器

如果需要配置讀寫優先順序分離,可以配置權重即可,參考文章:

keepalived+lvs超時設定產生的realserver的tcp連線不釋放問題:

怎麼樣讓 lvs 和 realserver 工作在同一臺機器上

keepalived的健康檢查方式

lvs & keepalived的tcp 長連線的有關問題解決方法

CentOS 6 5 安裝配置

關於centos的安裝,網上有很多詳細的教程。其實重點就在於硬碟的分割槽和軟體的定製這兩塊。下面我在virtualbox虛擬機上安裝 centos 6.5 i386 minimal。1.在起始選單處選擇 install or upgrade an existing system 2.跳過 media...

CentOS 6 5安裝配置Nginx

在安裝nginx前,需先安裝了g gcc openssl devel pcre devel和zlib devel軟體。yum y install gcc gcc c make autoconf automake libtool yum y install zlib zlib devel openss...

CentOS6 5安裝配置Samba

本文的場景是虛擬機器執行centos6.5,本機是win7,現欲把centos上的乙個資料夾共享出來,win的機器可以讀寫。samba與window連線需要使用netbios協議,請確認你的win7系統已經安裝了netbios協議。組成samba執行的有兩個服務,乙個是smb,另乙個是nmb smb...