欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

搭建高可用负载均衡DNS系统:DNS部署系列的第四篇 - LVS+Keepalived+Bind的实践

最编程 2024-08-10 20:30:55
...

[root@lvs-M ~]#cat /etc/keepalived/keepalived.conf

! ConfigurationFile for keepalived

 

global_defs {

   notification_email {

     acassen@firewall.loc

     failover@firewall.loc

    sysadmin@firewall.loc

   }

   notification_email_fromAlexandre.Cassen@firewall.loc

   smtp_server 192.168.200.1

   smtp_connect_timeout 30

   router_id lvs_105

}

 

vrrp_instance VI_WEB {

    state MASTER

    interface eth0

    virtual_router_id 51

    priority 100

    advert_int 1

    authentication {

        auth_type PASS

        auth_pass 1111

    }

    virtual_ipaddress {

        192.168.1.40/24

    }

}

 

#############LVSWEB################

virtual_server 192.168.1.40 80 {

    delay_loop 6

    lb_algo rr

    lb_kind DR

    nat_mask 255.255.255.0

 #  persistence_timeout 50

    protocol TCP

 

    real_server 192.168.1.201 80 {

        weight 100

        TCP_CHECK {

        connect_timeout 8      

        nb_get_retry 3

        delay_before_retry 3

        connect_port 80

        }

    }

   real_server 192.168.1.202 80 {

        weight 100             

        TCP_CHECK {

        connect_timeout 8      

        nb_get_retry 3

        delay_before_retry 3

        connect_port 80

        }

    }

   real_server 192.168.1.203 80 {

        weight 100

        TCP_CHECK {

        connect_timeout 8

        nb_get_retry 3

        delay_before_retry 3

        connect_port 80

        }

    }

}

 

#############DNSInstance start###############

vrrp_instance VI_DNS {

    state BACKUP

    interface eth0

    virtual_router_id 52

    priority 90

    advert_int 1

    authentication {

        auth_type PASS

        auth_pass 1111

    }

    virtual_ipaddress {

        192.168.1.30/24

    }

}

###########LVSDNS#######################

virtual_server 192.168.1.30 53 {

    delay_loop 6

    lb_algo rr

    lb_kind DR

    nat_mask 255.255.255.0

  # persistence_timeout 50

    protocol UDP

 

    real_server 192.168.1.107 53 {

        weight 100

        TCP_CHECK {

        connect_timeout 8

        nb_get_retry 3

        delay_before_retry 3

        connect_port 53

        }

    }

   real_server 192.168.1.108 53 {

        weight 100

        TCP_CHECK {

        connect_timeout 8

        nb_get_retry 3

        delay_before_retry 3

        connect_port 53

        }

    }

}