我们已经设置了一个 IHS 实例。该实例在远程机器上为 2 个 Websphere JVM 提供服务(这两个 WAS jvm 都在同一个远程机器上)。我们还没有创建任何集群。
现在,如果两个 JVM 都处于负载平衡模式,即 LoadBalanceWeight != 0,我们将无法通过端口 80 访问带有 web url 的应用程序静态文件(网页中嵌入的图像)。在检查 html 页面时,有多个“加载资源失败:服务器响应状态为 404(未找到) “。
但是,如果我们在任何一个 JVM 的 IHS 插件文件中设置 LoadBalanceWeight=0,我们就可以成功地使用 web url 访问应用程序静态文件 - 绝对没有问题。
工作 plugin-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>
两个节点都启动时插件日志中的异常如下 ->
在插件日志中获取->
[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。
对于在两个节点都启动时产生问题的负载平衡配置,我们在这里缺少什么?