欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

keepalived1.3.5的常見(jiàn)配置是什么以及常見(jiàn)問(wèn)題的解決方法

keepalived 1.3.5的常見(jiàn)配置是什么以及常見(jiàn)問(wèn)題的解決方法,很多新手對(duì)此不是很清楚,為了幫助大家解決這個(gè)難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來(lái)學(xué)習(xí)下,希望你能有所收獲。

海興網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),海興網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為海興上千家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)網(wǎng)站建設(shè)要多少錢(qián),請(qǐng)找那個(gè)售后服務(wù)好的海興做網(wǎng)站的公司定做!

1. keepalived配置及說(shuō)明

1.1 安裝

 [root@MySQL01 keepalived] tar -zxvf keepalived-1.3.5.tar.gz

 [root@mysql01 keepalived] cd keepalived-1.3.5/

 [root@mysql01 keepalived] ./configure --help|grep prefix

 [root@mysql01 keepalived] ./configure --prefix=/usr/local/keepalived

  [root@mysql01 keepalived] make && make install

 [root@mysql01 keepalived] cd /usr/local/keepalived

 [root@mysql02 keepalived]# cp /usr/local/keepalived/sbin/keepalived /usr/sbin/

 [root@mysql01 keepalived]# cp etc/sysconfig/keepalived /etc/sysconfig/

如果是Linux 6還需要拷貝下面文件:

 [root@mysql01 keepalived] cp /tmp/keepalived-1.3.2/keepalived/etc/init.d/keepalived /etc/rc.d/init.d/

1.2 修改keepalived日志輸出

vi /usr/lib/systemd/system/keepalived.service

# 確認(rèn)下面兩個(gè)變量指向正確的可執(zhí)行keepalived

EnvironmentFile

ExecStart

vi /etc/sysconfig/keepalived

修改keepalived日志輸出設(shè)備為0號(hào)設(shè)備,并修改系統(tǒng)日志程序0號(hào)輸出設(shè)備輸出文件,以及添加dump配置文件數(shù)據(jù)。

vi /etc/keepalived/keepalived.conf

KEEPALIVED_OPTIONS="-D -d -S 0"

# 修改keepalived使用0號(hào)日志輸出設(shè)備,并單獨(dú)輸出日志到指定文件。

vi /etc/rsyslog.conf

local0.*                /usr/local/keepalived/log/keepalived.log

1.3 修改keepalived配置文件

# 編輯keepalived配置文件,配置vip以及服務(wù)監(jiān)測(cè),通知腳本等模塊。

vi /etc/keepalived/keepalived.conf

vrrp_script check_run {

    script "/etc/keepalived/scripts/keepalived_check_mysql.sh"

    interval 30

    weight 0

}

vrrp_instance VI_1 {

    state BACKUP

    nopreempt

    interface team0           # 網(wǎng)卡,根據(jù)實(shí)際情況填寫(xiě)

    virtual_router_id 88        # 主備機(jī)器id必須相同,不同vrrp_instance需要不同。

    priority 101

    advert_int 1

    authentication {

        auth_type PASS

        auth_pass 1111

    }

    virtual_ipaddress {

        192.168.204.88     # 虛擬IP

    }

    track_script {

        check_run

    }

         notify_master /etc/keepalived/scripts/notify_master.sh

  }

1.4 keepalived.conf說(shuō)明

l  Notify  scripts

that  are  run when a vrrp instance or vrrp group

changes state, or a virtual server quorum changes between up and down.

# global script_user and script_group to MASTER transition

notify_master /path/to_master.sh [username [groupname]]

l  vrrp tracking scripts

that will cause vrrp instances to go down  it

they exit a non-zero exist status, or if a weight is specified will add

or subtract the weight to/from the priority of that vrrp instance.

l  nopreempt

A higher priority VRRP instance will normally preempt a lower priority instance

when it comes online.  "nopreempt" stops the higher priority machine taking

over the master role, and allows the lower priority machine to remain as

master.

NOTE: For this to work, the initial state must not be MASTER.

1.5 啟動(dòng)keepalived

啟用keepalived服務(wù),啟動(dòng)keepalived服務(wù):

systemctl enable keepalived

systemctl start keepalived

2. 問(wèn)題

2.1 not a regular non-executable file

l  現(xiàn)象

[root@mysql01 ~]# systemctl status keepalived.service
May  7 17:12:51 mysql01 Keepalived[5467]: Configuration file '/etc/keepalived/keepalived.conf' is not a regular non-executable file

l  原因

/etc/keepalived/keepalived.conf文件權(quán)限不是664。

l  解決

修改/etc/keepalived/keepalived.conf權(quán)限為664即可。

2.2 Cannot find an IP address to use for interface

l  現(xiàn)象

[root@mysql01 ~]# systemctl status keepalived.service
May 07 17:41:14 mysql01 Keepalived_vrrp[9448]: (VI_1): Cannot find an IP address to use for interface enp0s9

l  原因

/etc/keepalived/keepalived.conf配置文件中interface模塊,網(wǎng)卡上沒(méi)有IP地址,

l  解決

可以通過(guò)添加臨時(shí)IP來(lái)解決,或者在keepalived版本2.0.5之后添加dynamic_interfaces

[root@mysql01 ~]# ifconfig eth2 172.16.20.101/16 up
eth2配置IP,因?yàn)槿绻涌跊](méi)有IP,keepalived將以FAULT狀態(tài)啟動(dòng),keepalived 2.0.5以上版本,只需將dynamic_interfaces添加到global_defs即可

2.3 NetworkManager導(dǎo)致keepalived無(wú)法啟動(dòng)

l  現(xiàn)象

[root@mysql01 ~]# tail -f /var/log/messages

May  7 11:07:15 mysql01 Keepalived[8755]: daemon is already running

May  7 11:07:15 mysql01 systemd: PID file /usr/local/var/run/keepalived.pid not readable (yet?) after start.

May  7 11:08:45 mysql01 systemd: keepalived.service start operation timed out. Terminating.

May  7 11:08:45 mysql01 systemd: Failed to start LVS and VRRP High Availability Monitor.

May  7 11:08:45 mysql01 systemd: Unit keepalived.service entered failed state.

May  7 11:08:45 mysql01 systemd: keepalived.service failed.

l  原因

NetworkManager自動(dòng)管理網(wǎng)絡(luò),keepalived使用虛擬IP無(wú)法綁定到指定接口,日志中報(bào)錯(cuò)又無(wú)法定位原因,提前關(guān)閉NetworkManager,手工設(shè)置網(wǎng)卡ip地址即可。

l  解決

[root@mysql01 ~]# systemctl disable NetworkManager

[root@mysql01 ~]# systemctl stop NetworkManager

2.4 VRRP_Instance(VI_1) Now in FAULT state

l  現(xiàn)象

[mysql@mysql01 65mysql]$ sudo systemctl status keepalived

May 07 19:06:08 mysql01 Keepalived_vrrp[16144]: VRRP_Instance(VI_1) Entering BACKUP STATE

May 07 19:06:08 mysql01 Keepalived_vrrp[16144]: VRRP sockpool: [ifindex(4), proto(112), unicast(0), fd(10,11)]

May 07 19:06:12 mysql01 Keepalived_vrrp[16144]: VRRP_Instance(VI_1) Now in FAULT state

l  原因

/etc/keepalived/keepalived.conf配置文件vrrp_script模塊腳本未檢查,返回總是非0錯(cuò)誤值,導(dǎo)致keepalived狀態(tài)一直無(wú)法完成初始化,無(wú)法綁定vip。

l  解決

修正腳本錯(cuò)誤,重啟keepalived。

2.5 failed because a timeout was exceeded

●現(xiàn)象

[mysql@mysql02 keepalived]$ sudo systemctl status keepalived

keepalived.service - LVS and VRRP High Availability Monitor

   Loaded: loaded (/usr/lib/systemd/system/keepalived.service; enabled; vendor preset: disabled)

   Active: failed (Result: timeout) since Thu 2020-05-07 20:44:08 CST; 14min ago

  Process: 31073 ExecStart=/usr/local/keepalived/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS)

    Tasks: 6

   CGroup: /system.slice/keepalived.service

           ├─ 2687 /usr/local/keepalived/sbin/keepalived -D -d -S 0

           ├─ 2688 /bin/bash /etc/keepalived/scripts/keepalived_check_mysql.sh

           ├─ 2815 sleep 2

           ├─25921 /usr/local/keepalived/sbin/keepalived -D -d -S 0

           ├─25922 /usr/local/keepalived/sbin/keepalived -D -d -S 0

           └─25923 /usr/local/keepalived/sbin/keepalived -D -d -S 0

May 07 20:42:38 mysql02 systemd[1]: Starting LVS and VRRP High Availability Monitor...

May 07 20:42:38 mysql02 systemd[1]: PID file /var/run/keepalived.pid not readable (yet?) after start.

May 07 20:44:08 mysql02 systemd[1]: keepalived.service start operation timed out. Terminating.

May 07 20:44:08 mysql02 systemd[1]: Failed to start LVS and VRRP High Availability Monitor.

May 07 20:44:08 mysql02 systemd[1]: Unit keepalived.service entered failed state.

May 07 20:44:08 mysql02 systemd[1]: keepalived.service failed.

[mysql@mysql02 keepalived]$ sudo systemctl start keepalived

Job for keepalived.service failed because a timeout was exceeded. See "systemctl status keepalived.service" and "journalctl -xe" for details.

l  原因

原來(lái)keepalived程序運(yùn)行不正常,無(wú)法繼續(xù),systemctl restart keepalived已經(jīng)無(wú)法正確重啟keepalived。

l  解決

[mysql@mysql02 ~]$ ps -ef|grep keepalived

kill掉所有keepalived進(jìn)程,重啟keepalived

[mysql@mysql02 ~]$ sudo systemctl restart keepalived.service

[mysql@mysql02 ~]$ sudo systemctl status keepalived.service

看完上述內(nèi)容是否對(duì)您有幫助呢?如果還想對(duì)相關(guān)知識(shí)有進(jìn)一步的了解或閱讀更多相關(guān)文章,請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝您對(duì)創(chuàng)新互聯(lián)的支持。

網(wǎng)站題目:keepalived1.3.5的常見(jiàn)配置是什么以及常見(jiàn)問(wèn)題的解決方法
標(biāo)題網(wǎng)址:http://www.chinadenli.net/article38/iiepsp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)頁(yè)設(shè)計(jì)公司標(biāo)簽優(yōu)化自適應(yīng)網(wǎng)站定制開(kāi)發(fā)企業(yè)建站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

小程序開(kāi)發(fā)