91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

centos7中如何安裝配置keepalived

發布時間:2020-06-06 22:13:12 來源:億速云 閱讀:1765 作者:Leah 欄目:系統運維

centos7系統中如何安裝配置keepalived?相信大部分人都還沒學會這個技能,為了讓大家學會,給大家總結了以下內容,話不多說,一起往下看吧。

一、基礎環境

系統版本nginx版本keepalived版本ip作用
CentOS Linux release 7.5.1804 (Core)nginx/1.16.1keepalived-2.0.1810.1.1.31master
CentOS Linux release 7.5.1804 (Core)nginx/1.16.1keepalived-2.0.1810.1.1.32slave

VIP 10.1.1.111

二、安裝nginx

  1. 安裝nignx

    yum install nginx -y
  2. 修改nginx配置文件

    • master

      echo 'this is master 31' > /usr/share/nginx/html/index.html
    • slave

      echo 'this is slave 32' >  /usr/share/nginx/html/index.html 
  3. 啟動nginx

    systemctl start nginx 
  4. 測試nginx啟動

    curl localhost
    
    this is master

三、安裝keepalived

1、 創建依賴環境

yum -y install openssl-devel gcc gcc-c++
mkdir /etc/keepalived
wget https://www.keepalived.org/software/keepalived-2.0.18.tar.gz

2、安裝keepalived

tar -zxvf keepalived-2.0.18.tar.gz
mv keepalived-2.0.18 /usr/local/keepalived
cd /usr/local/keepalived
./configure && make && make install

3、創建啟動文件

cp  -a /usr/local/etc/keepalived   /etc/init.d/
cp  -a /usr/local/etc/sysconfig/keepalived    /etc/sysconfig/
cp  -a /usr/local/sbin/keepalived    /usr/sbin/

4、創建配置文件

  1. master

    cat > /etc/keepalived/keepalived.conf << EOF
    ! Configuration File for keepalived
    global_defs {
           router_id 31
    } 
    vrrp_instance VI_1 {
           state MASTER
           interface ens33
           virtual_router_id 3
           mcast_src_ip 10.1.1.132
           priority 200
           advert_int 1 
           authentication {
                   auth_type PASS
                   auth_pass 123456
           }
           virtual_ipaddress {
                   10.1.1.111/24
           }
    }
    EOF
  2. slave

    cat > /etc/keepalived/keepalived.conf << EOF
    ! Configuration File for keepalived
    global_defs {
           router_id 32
    } 
    vrrp_instance VI_1 {
           state BACKUP
           interface ens33
           virtual_router_id 3
           mcast_src_ip 10.1.1.132
           priority 90 
           advert_int 1 
           authentication {
                   auth_type PASS
                   auth_pass 123456
           }
           virtual_ipaddress {
                   10.1.1.111/24
           }
    }
    EOF

5、啟動keepalived

systemctl start keepalived
systemctl enable keepalived

四、測試

1、在兩臺服務器上測試

  1. master

    $ curl localhost
    this is master
    root@centos7[14:46:07]:~
    $ curl 10.1.1.111
    this is master
    root@centos7[15:03:29]:~
  2. slave

    $ curl localhost
    this is slave
    root@centos7[15:03:59]:/etc/keepalived
    $ curl 10.1.1.111
    this is master

2、關閉master的keepalived模仿down機

  1. master關閉keepalived

    $ systemctl stop keepalived 
  2. 在slave上面進行測試
$  curl localhost
this is slave
root@centos7[15:10:29]:/etc/keepalived
$ curl 10.1.1.111
this is slave

keepalived完成

關于centos7安裝配置keepalived的教程就分享到這里了,希望以上內容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

喀什市| 岑溪市| 曲阜市| 万荣县| 双辽市| 新疆| 平罗县| 南溪县| 南丰县| 肇源县| 察隅县| 永济市| 雷州市| 延庆县| 灵石县| 苍南县| 夏邑县| 城固县| 库尔勒市| 扎鲁特旗| 宁武县| 正镶白旗| 肃宁县| 天长市| 侯马市| 蛟河市| 嘉义县| 同德县| 镇远县| 湖南省| 太仓市| 陵川县| 兴宁市| 门头沟区| 克拉玛依市| 祁阳县| 深泽县| 咸丰县| 清原| 肥东县| 梅州市|