天天看點

keepalived+lvs部署中遇到的自動更改負載權重的問題

記一次keepalived.conf配置檔案錯誤排查
           

如題所述,配置檔案中master_backup和slave配置的權重分别為3和1,如配置檔案所示:

virtual_server xxx.xx  {
    delay_loop 
    lb_algo wrr
    lb_kind DR
    nat_mask 
    protocol TCP
    real_server xxx.xx  {
        weight 
        TCP_CHECK {
        connect_port 
        connect_timeout 
        nb_get_retry 
        delay_before_retry 
        }
        MISC_CHECK {
        misc_path "/home/mysql/keepalived/check_slave.py xxx.xx.20.123 5717"
        misc_dynamic
        }

    }
    real_server xxx.xx  {
        weight 
        TCP_CHECK {
        connect_port 
        connect_timeout 
        nb_get_retry 
         delay_before_retry 
        }
        MISC_CHECK {
        misc_path "/home/mysql/keepalived/check_slave.py xxx.xx.20.124 5717"
        misc_dynamic
        }
}
           

啟動keepalived之後,通過/var/log/messeges日志看到:

May 24 17:19:19 localhost Keepalived_healthcheckers[31275]: Changing weight from 1 to 125 for active service [xxx.xx.20.124]:5717 of VS [xxx.xx.20.225]:5717
May 24 17:19:19 localhost Keepalived_healthcheckers[31275]: Changing weight from 3 to 125 for active service [xxx.xx.20.123]:5717 of VS [xxx.xx.20.225]:5717
           
keepalived+lvs部署中遇到的自動更改負載權重的問題

通過ipvsadm -Ln看到:

keepalived+lvs部署中遇到的自動更改負載權重的問題

雖然LVS排程算法設定為wrr,但是keepalived從啟動就自動改變權重。

經過排查,發現MISC_CHECK内調用的檢查腳本路徑不對,修改之後啟動正常

繼續閱讀