Keepalived 1 2 9集群的安裝及配置

2021-07-15 14:42:10 字數 2136 閱讀 3044

keepalived-1.2.9集群的安裝及配置

說明:一、目 的:本文實現的linux集群是基於keepalived-1.2.9軟體實現,

三、適用環境:當對外路由或交換機繫結主機mac時適用

1. 環境及軟體:

1) 系統:debian6 amd64

2) 核心:linux 3.2.0-0.bpo.4-amd64

3) 軟體:keepalived-1.2.9

2. 配置:

master裝置ip: eth0: 10.10.1.200/24 eth1:192.168.61.253/21

backup裝置ip: eth0: 10.10.1.100/24 eth1:192.168.61.252/21

vip: 192.168.61.248/21

3. 安裝步驟:

1)公升級當前debian系統核心linux 2.6.32

a) 修改debian原始檔/etc/apt/sources.list,新增乙個向後相容的源(源位址如下)

deb squeeze-backports main

b) 更新debian原始檔關聯並公升級系統核心至3.2.0

# aptitude update

# aptitude -t squeeze-backports install linux 3.2.0-0.bpo.4-amd64

如果編譯nvdia的官方驅動的話,還要裝:

# aptitude -t squeeze-backports install linux-headers-3.2.0.bpo.4-amd64

2) 安裝keepalived-1.2.9

a) 首先要安裝keepalived所依賴的元件

# aptitude install make gcc libpopt-dev libnl-dev libcurl4-openssl-dev

b) 將keepalived-1.2.9.tar.gz檔案拷貝到/usr/local/soft下,解壓,編譯並安裝到/usr/local/keepalived

# mkdir /usr/local/soft

通過ftp將檔案拷貝至/usr/local/soft

# cd /usr/local/soft

# tar zxvf keepalived-1.2.9.tar.gz

# cd keepalived-1.2.9

# ./configure --prefix=/usr/local/keepalived

# make && make install

c) 重置keepalived相關檔案,以便開機自動啟動

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

# mkdir /etc/sysconfig

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

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

d) 修改keepalived啟動指令碼

# vi /etc/init.d/keepalived

修改/etc/init.d/keepalived檔案,部分片段如下(藍色標記為注釋內容,紅色標記為修改內容):

……#. /etc/rc.d/init.d/functions

. /lib/lsb/init-functions

# source configuration file (we set keepalived_options there)

. /etc/sysconfig/keepalived

retval=0

prog="keepalived"

start()

keepalived -d

retval=$?

echo

[ $retval -eq 0 ] && touch /var/lock/$prog

}stop()

……condrestart)

if [ -f /var/lock/$prog ]; then

stop

start

fi;;

……

3 集群容錯

invoker 封裝了provider位址和service介面資訊 directory 相當於是invoker的集合,它的值是可變化的,比如註冊中心推送的變更資料。cluster 將directory裡的多個invoker偽裝成乙個invoker,偽裝過程包含了容錯邏輯,預設是failover,呼叫...

(一)集群介紹

一 集群的種類 集群系統主要分為 1 ha 高可用集群,又叫雙機熱備。a 2臺機器a,b,正常是a提供服務,b待命閒置,當a宕機或服務宕掉,會切換至b繼續提供服務 b 常用的高可用開源軟體 heartbeat和keepalived 可以做負載均衡 2 lb 負載均衡集群 3 hpc 高效能計算集群 ...

HADOOP集群搭建 8 集群時間同步

1 檢查是否安裝ntp rpm qa grep ntp 安裝ntp yum install y ntp 安裝成功截圖 2 修改ntp配置檔案 修改3處 restrict 192.168.183.0 mask 255.255.255.0 nomodify notrap server 0.centos....