zoukankan      html  css  js  c++  java
  • linux LVS管理之keepalive

    Keepalive01:

    ! Configuration File for keepalived
     
    global_defs {
       notification_email {    ##接收邮件的地址;就是说通知邮件应该发送给谁,通常写自己的地址
           root@localhost      ##收件人,表示发送给本机的root用户
       }
       notification_email_from keepalived@localhost    ##发件人
       smtp_server 127.0.0.1
       smtp_connect_timeout 30
       router_id LVS    #标识本节点的字条串,通常为hostname,但不一定非得是hostname。故障发生时,邮件通知会用到。
       vrrp_mcast_group4 224.0.100.19    ##vrrp协议是通过多播向外发送的;这里指的是ipv4的多播地址
    }
     
    vrrp_instance VI_1 {    #自定义名称:VI_1
        state BACKUP
        interface ens192
        virtual_router_id 51    #主备ID相同
        priority 100    ##优先级
        nopreempt    ##工作于非抢占模式
        advert_int 1    ##广播通告的时间间隔,每隔多长时间向外发送自身的心跳信息,默认是一秒钟一次
        authentication {
            auth_type PASS
            auth_pass 1111
        }
        virtual_ipaddress {
            172.18.117.194 dev ens192
        }
    }
     
    virtual_server 172.18.117.194 80 {       # 定义转移ip端口80的集群服务
        delay_loop 3
        lb_algo rr
        lb_kind DR
        protocol TCP
        sorry_server 127.0.0.1 80 
        real_server 172.18.117.192 80 {      # 定义集群服务包含的RS 1
             weight 1                     # 权重为1
         HTTP_GET {                   # 定义RS1的健康状态检测
             url {
               path /
               status_code 200
             }
             connect_timeout 1
             nb_get_retry 3
             delay_before_retry 1
          }
        }
        real_server 172.18.117.193 80 {      # 定义集群服务包含的RS 2
             weight 1                      # 权重为1
         HTTP_GET {                    # 定义RS2的健康状态检测
             url {
               path /
               status_code 200
             }
             connect_timeout 1
             nb_get_retry 3
             delay_before_retry 1
          }
        }
    }

    Keepalive02:

    ! Configuration File for keepalived
     
    global_defs {
       notification_email {
           root@localhost
       }
       notification_email_from keepalived@localhost
       smtp_server 127.0.0.1
       smtp_connect_timeout 30
       router_id LVS
       vrrp_mcast_group4 224.0.100.19
    }
     
    vrrp_instance VI_1 {
        state BACKUP
        interface ens192
        virtual_router_id 51
        priority 99
        nopreempt
        advert_int 1
        authentication {
            auth_type PASS
            auth_pass 1111
        }
        virtual_ipaddress {
            172.18.117.194 dev ens192
        }
    }
     
    virtual_server 172.18.117.194 80 {       # 定义转移ip端口80的集群服务
        delay_loop 3
        lb_algo rr
        lb_kind DR
        protocol TCP
        sorry_server 127.0.0.1 80 
        real_server 172.18.117.192 80 {      # 定义集群服务包含的RS 1
             weight 1                     # 权重为1
         HTTP_GET {                   # 定义RS1的健康状态检测
             url {
               path /
               status_code 200
             }
             connect_timeout 1
             nb_get_retry 3
             delay_before_retry 1
          }
        }
        real_server 172.18.117.193 80 {      # 定义集群服务包含的RS 2
             weight 1                      # 权重为1
         HTTP_GET {                    # 定义RS2的健康状态检测
             url {
               path /
               status_code 200
             }
             connect_timeout 1
             nb_get_retry 3
             delay_before_retry 1
          }
        }
    }
  • 相关阅读:
    课后作业2
    软工团队项目度量反馈平台需求分析文档-北航软工暑期培训班团队项目1组
    《构建之法》教学笔记——Python中的效能分析与几个问题
    高职院校软件技术专业程序设计课程体系探索(一)
    network_node:host解决Docker容器化部署微服务出现的Dobbo通信问题
    微服务中的健康监测以及其在ASP.NET Core服务中实现运行状况检查
    词频统计
    消息队列
    Linux文件扩展思考随笔
    如何在Mirth Connect中创建和调用自定义Java代码
  • 原文地址:https://www.cnblogs.com/xue0123/p/10971697.html
Copyright © 2011-2022 走看看