如何干净closuresWLBS上的所有连接

我在Windows 2000中使用WLBS for 2个Web服务器来实现冗余和负载平衡。 当我想要使用其中一项服务时,我使用命令行中的“WLBS drainstop”。 但是,从监视IIS中打开连接的数量来看,现有连接需要很长时间才能closures。 如果我运行“WLBS停止”,其余的连接将挂起几分钟,而他们发现连接的另一端不再存在。 我们不需要长时间运行连接,并且页面请求在10秒内完好地返回。 有没有办法让WLBS或IISclosures任何打开的非活动连接,以便我可以从负载平衡中删除服务器,而无需等待所有打开的连接自行closures?

使用Joel讨论组closures保持活动状态,然后运行WLBS drainstop 的旧技巧是使其正常工作的关键。 然后,我在VBS中写了一个脚本来使整个事情自动化。 有两个脚本。 一个脚本从集群中删除节点,另一个脚本将节点重新联机。

删除脚本如下。

Set IISOBJ = getObject("IIS://LocalHost/W3SVC") Dim IISInstance Dim FoundIIS Dim IISInstanceName Dim NumConnections Dim WSHShell Set WSHShell = WScript.CreateObject("WScript.Shell") IISInstanceName = "Default Web Site" FoundIIS = False For each IISInstance in IISOBJ If (IISInstance.Class = "IIsWebServer") Then If (IISInstance.ServerComment = IISInstanceName) Then IISInstance.Put "AllowKeepAlive", False IISInstance.SetInfo() FoundIIS = True Exit For End If End If Next If Not FoundIIS Then WScript.Echo "Could Not Find IIS. Exiting." Wscript.quit() End If WSHShell.Run "wlbs drainstop" , 0, true WScript.Echo " Going To Sleep For: " & IISInstance.Get("ConnectionTimeout") & " Seconds" WScript.Sleep IISInstance.Get("ConnectionTimeout") * 1000 WSHShell.Run "wlbs stop" , 0, true WScript.Echo "Successfully removed node from load balancing" 

而使机器重新联机的脚本如下所示。

 Set IISOBJ = getObject("IIS://LocalHost/W3SVC") Dim IISInstance Dim FoundIIS Dim IISInstanceName IISInstanceName = "Default Web Site" FoundIIS = False For each IISInstance in IISOBJ If (IISInstance.Class = "IIsWebServer") Then If (IISInstance.ServerComment = IISInstanceName) Then IISInstance.Put "AllowKeepAlive", True IISInstance.SetInfo() FoundIIS = True Exit For End If End If Next If Not FoundIIS Then WScript.Echo "Could Not Find IIS. Exiting." Wscript.quit() End If Dim WSHShell Set WSHShell = WScript.CreateObject("WScript.Shell") WSHShell.Run "wlbs start" , 0, true WScript.Echo "Successfully added node to load balancing" 

您可以更改脚本顶部的IISInstanceNamevariables以匹配您的Web服务器的名称。 这是在“pipe理工具”下的“Internet信息服务”部分显示的名称。 您可以将其更改为您已命名的Web服务器。 总体来说,这有点笨重,但它的工作原理。 也可以将第一行改为

 Set IISInstance = getObject("IIS://LocalHost/W3SVC/1") 

然后删除整个循环寻找服务器的名称,但我认为这是多一点“正确”,以find服务器的名称,而不是一些号码,我不知道如果Windows将改变下一些添加和删除Web服务器实例的情况。