真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

centos7中如何安裝配置keepalived-創(chuàng)新互聯(lián)

centos7系統(tǒng)中如何安裝配置keepalived?相信大部分人都還沒學(xué)會(huì)這個(gè)技能,為了讓大家學(xué)會(huì),給大家總結(jié)了以下內(nèi)容,話不多說,一起往下看吧。

讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來自于我們對(duì)這個(gè)行業(yè)的熱愛。我們立志把好的技術(shù)通過有效、簡(jiǎn)單的方式提供給客戶,將通過不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長期合作伙伴,公司提供的服務(wù)項(xiàng)目有:國際域名空間、雅安服務(wù)器托管、營銷軟件、網(wǎng)站建設(shè)、南崗網(wǎng)站維護(hù)、網(wǎng)站推廣。

一、基礎(chǔ)環(huán)境

系統(tǒng)版本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. 啟動(dòng)nginx

    systemctl start nginx
  4. 測(cè)試nginx啟動(dòng)

    curl localhost
    
    this is master

三、安裝keepalived

1、 創(chuàng)建依賴環(huán)境

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、創(chuàng)建啟動(dòng)文件

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、創(chuàng)建配置文件

  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、啟動(dòng)keepalived

systemctl start keepalived
systemctl enable keepalived

四、測(cè)試

1、在兩臺(tái)服務(wù)器上測(cè)試

  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、關(guān)閉master的keepalived模仿down機(jī)

  1. master關(guān)閉keepalived

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

keepalived完成

關(guān)于centos7安裝配置keepalived的教程就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到。

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。


網(wǎng)站欄目:centos7中如何安裝配置keepalived-創(chuàng)新互聯(lián)
文章源于:http://weahome.cn/article/csijss.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部