IHS插件loadbalancer无法访问远程Websphere应用程序的静态文件

时间:2016-05-12 11:29:41

标签: websphere url-routing load-balancing websphere-7 ibmhttpserver

我们已经设置了一个IHS实例。该实例在远程机器中提供2个Websphere JVM(这两个WAS jvm都在同一个远程机器中)。我们还没有创建任何集群。

现在,如果两个JVM都处于负载均衡模式,即具有LoadBalanceWeight!= 0,则我们无法通过端口80访问带有web url的应用程序静态文件(嵌入在网页中的图像)。 在检查html页面时,有多个“无法加载资源的实例:服务器响应状态为404(未找到)”。

但是,如果我们在IHS插件文件中为任何一个JVM创建LoadBalanceWeight = 0,我们就能够成功访问带有web url的应用程序静态文件 - 绝对没有问题。

工作插件的内容 - cfg.xml - >

<?xml version="1.0" encoding="ISO-8859-1"?>
<Config ASDisableNagle="false" AcceptAllContent="false" AppServerPortPreference="HostHeader" ChunkedResponse="false" FIPSEnable="false" FailoverToNext="false" HTTPMaxHeaders="300" IISDisableNagle="false" IISPluginPriority="High" IgnoreDNSFailures="false" KillWebServerStartUpOnParseErr="false" MarkBusyDown="false" OS400ConvertQueryStringToJobCCSID="false" RefreshInterval="10" ResponseChunkSize="64" SSLConsolidate="true" TrustedProxyEnable="false" VHostMatchingCompat="false">
   <Log LogLevel="Error" Name="c:\IBM\HTTPServer\Plugins\logs\webserver1\http_plugin.log"/>
   <Property Name="ESIEnable" Value="true"/>
   <Property Name="ESIMaxCacheSize" Value="1024"/>
   <Property Name="ESIInvalidationMonitor" Value="false"/>
   <Property Name="ESIEnableToPassCookies" Value="false"/>
   <Property Name="ESICacheidFull" Value="false"/>
   <VirtualHostGroup Name="default_host">
      <VirtualHost Name="*:80"/>
      <VirtualHost Name="*:443"/>
   </VirtualHostGroup>
   <ServerCluster CloneSeparatorChange="false" GetDWLMTable="false" IgnoreAffinityRequests="true" LoadBalance="Round Robin" Name="sserver1_ASAPD01Node01_Cluster" PostBufferSize="64" PostSizeLimit="-1" RemoveSpecialHeaders="true" RetryInterval="60">
      <Server CloneID=eappsrv3 LoadBalanceWeight=100 ConnectTimeout="0" ExtendedHandshake="false" MaxConnections="-1" Name="ASAPD01Node01_server1" ServerIOTimeout="0" WaitForContinue="false">
         <Transport Hostname=x.x.x.x Port="9082" Protocol="http"/>
         <Transport Hostname=x.x.x.x Port="9445" Protocol="https">
            <Property Name="keyring" Value="c:\IBM\HTTPServer\Plugins\config\webserver1\plugin-key.kdb"/>
            <Property Name="stashfile" Value="c:\IBM\HTTPServer\Plugins\config\webserver1\plugin-key.sth"/>
         </Transport>
      </Server>
      <Server CloneID=eappsrv4 LoadBalanceWeight=0 Name="ASAPD01Node02_server1" WaitForContinue="false" ServerIOTimeout="0" MaxConnections="-1" ExtendedHandshake="false" ConnectTimeout="0">
         <Transport Protocol="http" Port="9084" Hostname=x.x.x.x/>
         <Transport Protocol="https" Port="9447" Hostname=x.x.x.x>
           <Property Name="keyring" Value="c:\IBM\HTTPServer\Plugins\config\webserver1\plugin-key.kdb"/>
           <Property Name="stashfile" Value="c:\IBM\HTTPServer\Plugins\config\webserver1\plugin-key.sth"/>
         </Transport>
      </Server>
   </ServerCluster>
   <UriGroup Name="default_host_server1_ASAPD01Node01_Cluster_URIs">
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/snoop/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/hello"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/hitcount"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="*.jsp"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="*.jsv"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="*.jsw"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/j_security_check"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/ibm_security_logout"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/servlet/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/mno/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/ivt/*"/>
   </UriGroup>
   <Route ServerCluster="server1_ASAPD01Node01_Cluster" UriGroup="default_host_server1_ASAPD01Node01_Cluster_URIs" VirtualHostGroup="default_host"/>
   <RequestMetrics armEnabled="false" loggingEnabled="false" rmEnabled="false" traceLevel="HOPS">
      <filters enable="false" type="URI">
         <filterValues enable="false" value="/snoop"/>
         <filterValues enable="false" value="/hitcount"/>
      </filters>
      <filters enable="false" type="SOURCE_IP">
         <filterValues enable="false" value="255.255.255.255"/>
         <filterValues enable="false" value="254.254.254.254"/>
      </filters>
      <filters enable="false" type="JMS">
         <filterValues enable="false" value="destination=aaa"/>
      </filters>
      <filters enable="false" type="WEB_SERVICES">
         <filterValues enable="false" value="wsdlPort=aaa:op=bbb:nameSpace=ccc"/>
      </filters>
   </RequestMetrics>
</Config>

两个节点启动时插件日志中的例外情况如下 - &gt;

在插件日志中获取 - &gt;

[Fri May 13 02:24:13 2016] 00001828 000017c0 - DEBUG: lib_util: parseHostHeader: Defaulting port for scheme 'http'
[Fri May 13 02:24:13 2016] 00001828 000017c0 - DEBUG: lib_util: parseHostHeader: Host: 'www.abc.com', port 80
[Fri May 13 02:24:13 2016] 00001828 000017c0 - DEBUG: ws_common: websphereCheckConfig: Current time is 1463106253, next stat time is 1463106260
[Fri May 13 02:24:13 2016] 00001828 000017c0 - DETAIL: ws_common: websphereShouldHandleRequest: trying to match a route for: vhost='www.abc.com'; uri='/css/bootstrap.css'
[Fri May 13 02:24:13 2016] 00001828 000017c0 - DEBUG: ws_common: webspherePortNumberForMatching: Using logical.
[Fri May 13 02:24:13 2016] 00001828 000017c0 - TRACE: ws_common: websphereVhostMatch: Comparing '*:443' to 'www.abc.com:80' in VhostGroup: default_host
[Fri May 13 02:24:13 2016] 00001828 000017c0 - TRACE: ws_common: websphereVhostMatch: Comparing '*:80' to 'www.abc.com:80' in VhostGroup: default_host
[Fri May 13 02:24:13 2016] 00001828 000017c0 - DEBUG: ws_common: websphereVhostMatch: Found a match '*:80' to 'www.abc.com:80' in VhostGroup: default_host with score 1, exact match 0
[Fri May 13 02:24:13 2016] 00001828 000017c0 - TRACE: ws_common: websphereUriMatch: uri length smaller than uri defs so skipping the rest
[Fri May 13 02:24:13 2016] 00001828 000017c0 - TRACE: ws_common: websphereUriMatch: Failed to match: /css/bootstrap.css
[Fri May 13 02:24:13 2016] 00001828 000017c0 - DETAIL: ws_common: websphereShouldHandleRequest: No route found
[Fri May 13 02:24:13 2016] 00001828 000017c0 - TRACE: mod_was_ap20_http: as_handler: In the app server handler
[Fri May 13 02:24:13 2016] 00001828 0000173c - DEBUG: lib_util: parseHostHeader: Defaulting port for scheme 'http'
[Fri May 13 02:24:13 2016] 00001828 0000173c - DEBUG: lib_util: parseHostHeader: Host: 'www.abc.com', port 80
[Fri May 13 02:24:13 2016] 00001828 0000173c - DEBUG: ws_common: websphereCheckConfig: Current time is 1463106253, next stat time is 1463106260
[Fri May 13 02:24:13 2016] 00001828 0000173c - DETAIL: ws_common: websphereShouldHandleRequest: trying to match a route for: vhost='www.abc.com'; uri='/css/docs.min.css'
[Fri May 13 02:24:13 2016] 00001828 0000173c - DEBUG: ws_common: webspherePortNumberForMatching: Using logical.
[Fri May 13 02:24:13 2016] 00001828 0000173c - TRACE: ws_common: websphereVhostMatch: Comparing '*:443' to 'www.abc.com:80' in VhostGroup: default_host
[Fri May 13 02:24:13 2016] 00001828 0000173c - TRACE: ws_common: websphereVhostMatch: Comparing '*:80' to 'www.abc.com:80' in VhostGroup: default_host
[Fri May 13 02:24:13 2016] 00001828 0000173c - DEBUG: ws_common: websphereVhostMatch: Found a match '*:80' to 'www.abc.com:80' in VhostGroup: default_host with score 1, exact match 0
[Fri May 13 02:24:13 2016] 00001828 0000173c - TRACE: ws_common: websphereUriMatch: uri length smaller than uri defs so skipping the rest
[Fri May 13 02:24:13 2016] 00001828 0000173c - TRACE: ws_common: websphereUriMatch: Failed to match: /css/docs.min.css
[Fri May 13 02:24:13 2016] 00001828 0000173c - DETAIL: ws_common: websphereShouldHandleRequest: No route found
[Fri May 13 02:24:13 2016] 00001828 0000173c - TRACE: mod_was_ap20_http: as_handler: In the app server handler

注意,对于两个WAS JVM,ibm-web-ext.xmi文件中的“fileServingEnabled”属性设置为true。

我们在这里遇到的负载均衡配置是什么,当两个节点都启动时会产生问题?

2 个答案:

答案 0 :(得分:0)

两个插件日志消息表明请求的URI没有映射到plugin-cfg.xml文件中列出的任何内容。您的XML是否包含/ images / *的上下文根?您是否手动组合了两个生成的plugin-cfg.xml文件?如果是这样,您可能会遗漏信息。

如果插件无法映射请求,它会将其返回给Web服务器以处理它,在您的情况下会导致404响应。

如果没有完整的插件跟踪以及工作和非工作实例的相关XML,很难给出明确的答案。

答案 1 :(得分:0)

最终解决了这个问题。我怀疑这是由于会话处理中的问题

而不是

<Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/mno/*"/>

我在WAS控制台会话管理中为两个节点设置了单独的关联cookie,并将更新的插件文件设置为

<Uri AffinityCookie="App1" AffinityURLIdentifier="jsessionid" Name="/mno/*"/>
<Uri AffinityCookie="App2" AffinityURLIdentifier="jsessionid" Name="/mno/*"/>

在重新加载页面时,静态图像即将到来。

然而,现在团队面临着PPR的一些问题 - ;部分页面重新加载'应用程序开发团队正在检查的异常