WebSphere:问题合并plugin-cfg.xml以实现负载平衡

时间:2014-09-30 14:02:04

标签: load-balancing websphere-6.1

我正在尝试合并和负载平衡多个独立的WebSphere 6.1 Express服务器。我正在使用此处提供的说明:

合并来自多个节点的plugin-cfg.xml文件 http://www-01.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.base.doc/ae/twsv_configsimplelb.html?lang=en

在这里:

跨多个应用程序服务器配置文件配置简单负载平衡 http://www-01.ibm.com/support/knowledgecenter/SSAW57_6.1.0/com.ibm.websphere.base.doc/info/aes/ae/twsv_configsimplelb.html

我将两个不同WAS服务器的两个plugin-cfg.xml文件合并为一个,更新了两个WAS服务器的web服务器设置以指向这个新文件,并更新了插件以使用新的合并文件。服务器启动,但我只获得请求转到第一个WebSphere服务器。我很清楚我为< VirtualHostGroup>做了什么元素不正确,并且是这个问题的背后。我认为我需要把所有的< VirtualHost>元素合并为一个组合< VirtualHostGroup>元素,还把所有的< Server>元素合并为一个< ServerCluster>元素,但我只是在猜测。

WebSphere server1 plugin-cfg.xml文件:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--HTTP server plugin config file for the webserver websphere02Node19Cell.custTestNode.webserver1 generated on 2014.09.25 at 06:45:03 PM EDT-->
<Config ASDisableNagle="false" AcceptAllContent="false" AppServerPortPreference="HostHeader" ChunkedResponse="false" FIPSEnable="false" IISDisableNagle="false" IISPluginPriority="High" IgnoreDNSFailures="false" RefreshInterval="60" ResponseChunkSize="64" VHostMatchingCompat="false">
   <Log LogLevel="Error" Name="E:\eStorefront\Cust\Test\plugin/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"/>
   <VirtualHostGroup Name="default_host">
      <VirtualHost Name="*:9098"/>
      <VirtualHost Name="*:80"/>
      <VirtualHost Name="*:9475"/>
      <VirtualHost Name="*:5097"/>
      <VirtualHost Name="*:5096"/>
      <VirtualHost Name="*:443"/>
   </VirtualHostGroup>
   <ServerCluster CloneSeparatorChange="false" GetDWLMTable="false" IgnoreAffinityRequests="true" LoadBalance="Round Robin" Name="server1_custTestNode_Cluster" PostBufferSize="64" PostSizeLimit="-1" RemoveSpecialHeaders="true" RetryInterval="60">
      <Server ConnectTimeout="0" ExtendedHandshake="false" MaxConnections="-1" Name="custTestNode_server1" ServerIOTimeout="0" WaitForContinue="false">
         <Transport Hostname="websphere02" Port="9098" Protocol="http"/>
         <Transport Hostname="websphere02" Port="9475" Protocol="https">
            <Property Name="keyring" Value="E:\eStorefront\Cust\Test\plugin/config/webserver1/plugin-key.kdb"/>
            <Property Name="stashfile" Value="E:\eStorefront\Cust\Test\plugin/config/webserver1/plugin-key.sth"/>
         </Transport>
      </Server>
   </ServerCluster>
   <UriGroup Name="default_host_server1_custTestNode_Cluster_URIs">
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/gatewayRMIWEB/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/ccWEB/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/ccStandAlone/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/ivt/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/monitorServerWEB/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/customerInquiry/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/storefrontAdminWEB/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/storefrontB2BWEB/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/storefrontB2CWEB/*"/>
   </UriGroup>
   <Route ServerCluster="server1_custTestNode_Cluster" UriGroup="default_host_server1_custTestNode_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>

WebSphere server2 plugin-cfg.xml文件:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--HTTP server plugin config file for the webserver websphere02Node23Cell.custTest2Node.webserver1 generated on 2014.09.29 at 04:40:12 PM EDT-->
<Config ASDisableNagle="false" AcceptAllContent="false" AppServerPortPreference="HostHeader" ChunkedResponse="false" FIPSEnable="false" IISDisableNagle="false" IISPluginPriority="High" IgnoreDNSFailures="false" RefreshInterval="60" ResponseChunkSize="64" VHostMatchingCompat="false">
   <Log LogLevel="Error" Name="E:\eStorefront\Cust\Test\plugin/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"/>
   <VirtualHostGroup Name="default_host">
      <VirtualHost Name="*:9133"/>
      <VirtualHost Name="*:80"/>
      <VirtualHost Name="*:9491"/>
      <VirtualHost Name="*:5105"/>
      <VirtualHost Name="*:5104"/>
      <VirtualHost Name="*:443"/>
   </VirtualHostGroup>
   <ServerCluster CloneSeparatorChange="false" GetDWLMTable="false" IgnoreAffinityRequests="true" LoadBalance="Round Robin" Name="server1_custTest2Node_Cluster" PostBufferSize="64" PostSizeLimit="-1" RemoveSpecialHeaders="true" RetryInterval="60">
      <Server ConnectTimeout="0" ExtendedHandshake="false" MaxConnections="-1" Name="custTest2Node_server1" ServerIOTimeout="0" WaitForContinue="false">
         <Transport Hostname="websphere02" Port="9133" Protocol="http"/>
         <Transport Hostname="websphere02" Port="9491" Protocol="https">
            <Property Name="keyring" Value="E:\eStorefront\Cust\Test\plugin/config/webserver1/plugin-key.kdb"/>
            <Property Name="stashfile" Value="E:\eStorefront\Cust\Test\plugin/config/webserver1/plugin-key.sth"/>
         </Transport>
      </Server>
   </ServerCluster>
   <UriGroup Name="default_host_server1_custTest2Node_Cluster_URIs">
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/gatewayRMIWEB/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/ivt/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/customerInquiry/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/storefrontAdminWEB/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/storefrontB2BWEB/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/storefrontB2CWEB/*"/>
   </UriGroup>
   <Route ServerCluster="server1_custTest2Node_Cluster" UriGroup="default_host_server1_custTest2Node_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>

合并插件-cfg.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--HTTP server plugin config file for the webserver websphere02Node19Cell.custTestNode.webserver1 generated on 2014.09.25 at 06:45:03 PM EDT-->
<Config ASDisableNagle="false" AcceptAllContent="false" AppServerPortPreference="HostHeader" ChunkedResponse="false" FIPSEnable="false" IISDisableNagle="false" IISPluginPriority="High" IgnoreDNSFailures="false" RefreshInterval="60" ResponseChunkSize="64" VHostMatchingCompat="false">
   <Log LogLevel="Trace" Name="E:\eStorefront\CTire\Test\plugin/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"/>
   <VirtualHostGroup Name="default_host">
      <VirtualHost Name="*:9098"/>
      <VirtualHost Name="*:9475"/>
      <VirtualHost Name="*:5097"/>
      <VirtualHost Name="*:5096"/>
      <VirtualHost Name="*:80"/>
      <VirtualHost Name="*:443"/>
   </VirtualHostGroup>
   <VirtualHostGroup Name="default_host2">
      <VirtualHost Name="*:9133"/>
      <VirtualHost Name="*:9491"/>
      <VirtualHost Name="*:5105"/>
      <VirtualHost Name="*:5104"/>
      <VirtualHost Name="default_host2:80"/>
      <VirtualHost Name="default_host2:443"/>
   </VirtualHostGroup>
   <ServerCluster CloneSeparatorChange="false" GetDWLMTable="false" IgnoreAffinityRequests="true" LoadBalance="Round Robin" Name="server1_custTestNode_Cluster" PostBufferSize="64" PostSizeLimit="-1" RemoveSpecialHeaders="true" RetryInterval="60">
      <Server ConnectTimeout="0" ExtendedHandshake="false" MaxConnections="-1" Name="custTestNode_server1" ServerIOTimeout="0" WaitForContinue="false">
         <Transport Hostname="websphere02" Port="9098" Protocol="http"/>
         <Transport Hostname="websphere02" Port="9475" Protocol="https">
            <Property Name="keyring" Value="E:\eStorefront\CTire\Test\plugin/config/webserver1/plugin-key.kdb"/>
            <Property Name="stashfile" Value="E:\eStorefront\CTire\Test\plugin/config/webserver1/plugin-key.sth"/>
         </Transport>
      </Server>
  </ServerCluster>
  <ServerCluster CloneSeparatorChange="false" GetDWLMTable="false" IgnoreAffinityRequests="true" LoadBalance="Round Robin" Name="server1_custTest2Node_Cluster" PostBufferSize="64" PostSizeLimit="-1" RemoveSpecialHeaders="true" RetryInterval="60">
      <Server ConnectTimeout="0" ExtendedHandshake="false" MaxConnections="-1" Name="custTest2Node_server1" ServerIOTimeout="0" WaitForContinue="false">
         <Transport Hostname="websphere02" Port="9133" Protocol="http"/>
         <Transport Hostname="websphere02" Port="9491" Protocol="https">
            <Property Name="keyring" Value="E:\eStorefront\CTire\Test\plugin/config/webserver1/plugin-key.kdb"/>
            <Property Name="stashfile" Value="E:\eStorefront\CTire\Test\plugin/config/webserver1/plugin-key.sth"/>
         </Transport>
      </Server>
   </ServerCluster>
   <UriGroup Name="default_host_server1_custTestNode_Cluster_URIs">
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/gatewayRMIWEB/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/ivt/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/customerInquiry/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/storefrontAdminWEB/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/storefrontB2BWEB/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/storefrontB2CWEB/*"/>
   </UriGroup>
   <UriGroup Name="default_host2_server1_custTest2Node_Cluster_URIs">
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/gatewayRMIWEB/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/ivt/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/customerInquiry/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/storefrontAdminWEB/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/storefrontB2BWEB/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/storefrontB2CWEB/*"/>
   </UriGroup>
   <Route ServerCluster="server1_custTestNode_Cluster" UriGroup="default_host_server1_custTestNode_Cluster_URIs" VirtualHostGroup="default_host"/>
   <Route ServerCluster="server1_custTest2Node_Cluster" UriGroup="default_host2_server1_custTest2Node_Cluster_URIs" VirtualHostGroup="default_host2"/>
   <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>

1 个答案:

答案 0 :(得分:3)

您的文件存在一些问题。

首先,您需要为这两台服务器设置cloneId,如configure a unique HTTP session clone ID 所述:

  

使用管理配置唯一的HTTP会话克隆ID   控制台,完成以下步骤:

     
      
  • 点击Servers > Server Types > WebSphere application servers > server_name
  •   
  • Container Settings下,点击Web Container Settings > Web container
  •   
  • Additional Properties下,点击Custom properties > New
  •   
  • 在“名称”字段中输入HttpSessionCloneId,在“值”字段中输入服务器的唯一值   唯一值的长度必须为8 - 9个字母数字字符。例如,test1234是有效的cloneID值。
  •   
  • 点击ApplyOK
  •   
  • 单击Save将配置更改保存到主配置。
  •   

然后你实际上需要合并(不要复制两者),plugin-cfg.xml的特定部分(我只是发布合并后的部分而不是整个文件)。因此,您需要一个VirtualHostGroupServerClusterUriGroupRoute。对于VirtualHostGroup,您只需要80和443个端口。

<VirtualHostGroup Name="default_host">
  <VirtualHost Name="*:80"/>
  <VirtualHost Name="*:443"/>
</VirtualHostGroup>
<ServerCluster CloneSeparatorChange="false" GetDWLMTable="false" IgnoreAffinityRequests="true" LoadBalance="Round Robin" Name="server1_custTestNode_Cluster" PostBufferSize="64" PostSizeLimit="-1" RemoveSpecialHeaders="true" RetryInterval="60">
  <Server CloneID="s111111" LoadBalanceWeight="1" ConnectTimeout="0" ExtendedHandshake="false" MaxConnections="-1" Name="custTestNode_server1" ServerIOTimeout="0" WaitForContinue="false">
     <Transport Hostname="websphere02" Port="9098" Protocol="http"/>
     <Transport Hostname="websphere02" Port="9475" Protocol="https">
        <Property Name="keyring" Value="E:\eStorefront\CTire\Test\plugin/config/webserver1/plugin-key.kdb"/>
        <Property Name="stashfile" Value="E:\eStorefront\CTire\Test\plugin/config/webserver1/plugin-key.sth"/>
     </Transport>
  </Server>
  <Server CloneID="s22222" LoadBalanceWeight="1" ConnectTimeout="0" ExtendedHandshake="false" MaxConnections="-1" Name="custTest2Node_server1" ServerIOTimeout="0" WaitForContinue="false">
     <Transport Hostname="websphere02" Port="9133" Protocol="http"/>
     <Transport Hostname="websphere02" Port="9491" Protocol="https">
        <Property Name="keyring" Value="E:\eStorefront\CTire\Test\plugin/config/webserver1/plugin-key.kdb"/>
        <Property Name="stashfile" Value="E:\eStorefront\CTire\Test\plugin/config/webserver1/plugin-key.sth"/>
     </Transport>
  </Server>
 <PrimaryServers>
   <Server Name="custTestNode_server1"/>
   <Server Name="custTest2Node_server1"/>
  </PrimaryServers>
</ServerCluster>
<UriGroup Name="default_host_server1_custTestNode_Cluster_URIs">
  <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/gatewayRMIWEB/*"/>
  <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/ccWEB/*"/>
  <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/ccStandAlone/*"/>
  <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/ivt/*"/>
  <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/monitorServerWEB/*"/>
  <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/customerInquiry/*"/>
  <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/storefrontAdminWEB/*"/>
  <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/storefrontB2BWEB/*"/>
  <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/storefrontB2CWEB/*"/>
 </UriGroup>
<Route ServerCluster="server1_custTestNode_Cluster" UriGroup="default_host_server1_custTestNode_Cluster_URIs" VirtualHostGroup="default_host"/>

我希望你明白这个主意。你必须测试它。您可以删除您不想处理的这些Uris,例如monitorServerWEB。如果可以路由到给定服务器的简单方法是为其他服务器设置LoadBalanceWeight=0。我看到你已经在插件中启用了跟踪,所以它会为你提供更多关于插件试图匹配uri,vhost和服务器的详细信息。