AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 471886
Accepted
R. S.
R. S.
Asked: 2013-01-24 14:33:59 +0800 CST2013-01-24 14:33:59 +0800 CST 2013-01-24 14:33:59 +0800 CST

Keepalived:仅最高权重调度

  • 772

我有一个 keepalived 设置,在一个 ip 后面有三个服务器。一个设置为抱歉的服务器,只提供维护页面,另外两个是实际的应用程序服务器。我们希望它的设置使得流量只路由到一台服务器,直到它出现故障,然后让另一台服务器接管流量,直到主服务器恢复在线。

遗漏 lb_algo 会导致此错误并且 keepalived 拒绝启动

Jan 23 17:15:22 fw001 kernel: IPVS: Scheduler module ip_vs_ not found

lb_algo 的唯一选项是:

rr|wrr|lc|wlc|lblc|sh|dh

所有负载都以某种方式在活动服务器之间进行平衡。

配置示例

virtual_server 203.0.113.0 80 {
    delay_loop 60
    lb_algo wrr
    lb_kind NAT
    nat_mask 255.255.255.0
    persistence_timeout 50
    protocol TCP

    sorry_server 10.0.0.3 8080

    real_server 10.0.0.1 8080 {
        weight 100

        HTTP_GET {
            url {
                path /alive
                digest 7a13a825b31584fe9b135ab53974d893
            }
            connect_timeout 30
            nb_get_retry 30
            delay_before_retry 10
        }
    }

    real_server 10.0.0.2 8080 {
        weight 0

        HTTP_GET {
            url {
                path /alive
                digest 7a13a825b31584fe9b135ab53974d893
            }
            connect_timeout 30
            nb_get_retry 30
            delay_before_retry 10
        }
    }
}

有什么办法吗?

keepalived
  • 1 1 个回答
  • 3752 Views

1 个回答

  • Voted
  1. Best Answer
    R. S.
    2013-01-25T11:11:51+08:002013-01-25T11:11:51+08:00

    来自 LVS 邮件列表

    None of the current IPVS schedulers do know "highest weight" balancing.
    
    With the "weighted" schedulers, you can e.g. give your primary server 
    a weight of max. 65535 and your secondary server a weight of 1. This way,
    you've "almost" reached the point you're asking for - however, one out
    of 64k of incoming connections will go for the "secondary" server even
    while the primary server is still up and running.
    
    If your application is balancing-ready, this behaviour may be a good thing.
    For example, by automatically using the secondary system for a few live 
    requests, you ensure your secondary system is actually working.
    By sending some live traffic, you may also "warm up" application-specific
    caches, so upon a "real" failover, the application will perform much better
    than with empty caches.
    
    If you really don't need (or your applications can't handle) the 
    "balancing" part (distribute traffic to different servers at the same time),
    you'd probably better run "typical" high availability/failover software 
    like Pacemaker or some VRRP daemon.
    
    For example, you might put all three boxes into the same VRPR instance
    and assign them different VRRP priorities, and VRRP will sort out which box 
    has the "best" priority and is going to be the only live system. This results
    in some kind of "cascading" failover.
    
    
    If you need balancing to distribute traffic among different servers,
    and you'd still like to have this "cascading" failover, you'll need to run 
    at least two balancer (pairs): one for the "primary" server farm, with the 
    VIP of the other balancer being set as sorry server. The second balancer 
    in turn balances to the "secondary" server farm and also has the maintenance 
    server set as a sorry server.
    
    One usecase for such scenarios are web farms with slightly different content: 
    if the primary farm drops out of service (e.g. due to overload or some
    bleeding-edge feature malfunctioning), the secondary farm may serve a less 
    feature-rich version of the same service.
    
    • 0

相关问题

  • 防止 VRRP Master 在失败后成为 Master

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve