【问题标题】:using ldirectord for load balancing GIT servers使用 ldirectord 对 GIT 服务器进行负载平衡
【发布时间】:2012-05-24 19:03:30
【问题描述】:

我正在尝试在 CentOS 4.5 系统上使用 ldirectord 对两个 GIT 服务器(即 server1server2)进行负载平衡。

名为 git-ld 的服务器充当 ldirectord 主服务器。

两台服务器都在端口 9418 上运行 git-daemons,并且具有相同的 git 项目集。 git-ld 上没有运行 Git 守护进程

注意:我对向他们提供 HA 服务不感兴趣,只是负载平衡。

这是我的 ldirectord.cf 配置。

checktimeout=3
checkinterval=5
autoreload=yes
logfile="/var/log/ldirectord.log"
quiescent=yes

##### Git load balancing configuration #####

virtual=git-ld:9418            #git-ld is a virtual IP 172.10.10.10
   real=server1:9418 gate 10   # server1 is IP 10.20.20.01
   real=server2:9418 gate 5    # server1 is IP 10.20.20.02
   checkport=777
   service=simpletcp
   scheduler=wlc
   receive="OPEN"
   protocol=tcp
   checktype=negotiate


##### Web server load balancing configuration #####

virtual=git-ld:80
   real=server1:80 gate 10
   real=server2:80 gate 5
   service=http
   request="test.html"
   receive="Still alive"
   scheduler=wlc
   protocol=tcp
   checktype=negotiate

我正在使用自定义 tcp 服务检查服务器的运行状况,该服务在端口 777 上的两个 git 服务器(服务器 1 和 2)上运行,如果服务器足够健康以服务请求,则返回“OPEN”。

如您所见,我还在使用来自 ldirectord.cf 文件的 Web 服务器进行负载平衡。

现在,Web 服务器的负载平衡完美。每次我尝试访问 http://git-ld/ 时,其中一台服务器都会为网页提供服务。

但是,当我使用以下命令向 git-ld 请求 git clone 时,我无法让服务器响应:

git clone git://git-ld/project.git

几分钟后命令就会超时。

如果我直接从中克隆项目,服务器会为 git 请求提供服务。

git clone git://server1/project.git

git clone git://server1/project.git

我确信服务器响应正常:

[git-ld]# ipvsadm -Ln
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
TCP  172.10.10.10:9418 wlc
  -> 10.20.20.01:9418             Route   10     0          0
  -> 10.20.20.02:9418             Route   5      0          0

[git-ld]# ipvsadm -Ln --stats
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port               Conns   InPkts  OutPkts  InBytes OutBytes
  -> RemoteAddress:Port
TCP  172.10.10.10:9418                 6       23        0     1380        0
  -> 10.20.20.01:9418                  4       16        0      960        0
  -> 10.20.20.02:9418                  2        7        0      420        0

有没有其他人成功地在他们的网络上设置了这样的负载平衡?我做错了什么明显吗?

我在哪里可以找到可以用来深入了解问题的日志或其他消息?

【问题讨论】:

    标签: git centos load-balancing


    【解决方案1】:

    你没有说你是从哪台机器上测试的:

    git clone git://git-ld/project.git
    

    您描述的行为让我怀疑您正在从 ldirectord 服务器本身的 shell 进行测试,即 git-ld。再次尝试 git clone,但在另一台计算机上。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-24
      • 1970-01-01
      • 2016-08-23
      • 1970-01-01
      • 2017-03-25
      • 2011-10-01
      • 1970-01-01
      • 2021-03-17
      相关资源
      最近更新 更多