代理服务器在Websphere应用程序服务器8.5.5中的负载平衡配置

时间:2015-09-28 10:23:09

标签: proxy server websphere

我正在尝试配置代理服务器以在我的两个应用程序服务器之间对HTTP请求进行负载平衡。

我已经实现了使用循环方法路由请求。

现在,我想知道如何配置启用会话亲和性,因为我在登录后面临问题,错误 - 会话终止。

提前致谢。如果需要任何进一步的信息,请告诉我。

    <?xml version="1.0" encoding="ISO-8859-1"?><!--HTTP server plugin config file for the cell sterlingdevCell01 generated on 2015.09.30 at 06:53:03 PM IST-->
<Config ASDisableNagle="false" AcceptAllContent="true" AppServerPortPreference="HostHeader" ChunkedResponse="false" FIPSEnable="false" FailoverToNext="false" HTTPMaxHeaders="300" IISDisableFlushFlag="false" IISDisableNagle="false" IISPluginPriority="High" IgnoreDNSFailures="false" KillWebServerStartUpOnParseErr="false" MarkBusyDown="false" OS400ConvertQueryStringToJobCCSID="false" RefreshInterval="60" ResponseChunkSize="64" SSLConsolidate="true" StrictSecurity="false" TrustedProxyEnable="false" UseInsecure="false" VHostMatchingCompat="false">
   <Log LogLevel="Error" Name="/usr/IBM/WebSphere/Plugins/logs/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"/>
   <Property Name="PostSizeLimit" Value="-1"/>
   <Property Name="PostBufferSize" Value="0"/>
   <Property Name="PluginInstallRoot" Value="/usr/IBM/WebSphere/Plugins/"/>
   <Property Name="Keyfile" Value="/usr/IBM/WebSphere/Plugins/etc/plugin-key.kdb"/>
   <Property Name="Stashfile" Value="/usr/IBM/WebSphere/Plugins/etc/plugin-key.sth"/>
   <VirtualHostGroup Name="default_host">
      <VirtualHost Name="*:9080"/>
      <VirtualHost Name="*:80"/>
      <VirtualHost Name="*:9443"/>
      <VirtualHost Name="*:5060"/>
      <VirtualHost Name="*:5061"/>
      <VirtualHost Name="*:443"/>
      <VirtualHost Name="*:9066"/>
      <VirtualHost Name="*:9086"/>
      <VirtualHost Name="*:9449"/>
      <VirtualHost Name="*:9049"/>
      <VirtualHost Name="*:9067"/>
      <VirtualHost Name="*:9087"/>
      <VirtualHost Name="*:9450"/>
      <VirtualHost Name="*:9050"/>
   </VirtualHostGroup>
   <VirtualHostGroup Name="proxy_host">
      <VirtualHost Name="*:1024"/>
      <VirtualHost Name="*:1025"/>
      <VirtualHost Name="*:9061"/>
      <VirtualHost Name="*:9062"/>
      <VirtualHost Name="*:9080"/>
      <VirtualHost Name="*:9081"/>
   </VirtualHostGroup>
   <ServerCluster CloneSeparatorChange="false" GetDWLMTable="false" IgnoreAffinityRequests="true" LoadBalance="Round Robin" Name="cluster01" PostBufferSize="0" PostSizeLimit="-1" RemoveSpecialHeaders="true" RetryInterval="60" ServerIOTimeoutRetry="-1">
      <Server CloneID="19vq01jfc" ConnectTimeout="5" ExtendedHandshake="false" LoadBalanceWeight="2" MaxConnections="-1" Name="sterlingdevNode01_member01" ServerIOTimeout="900" WaitForContinue="false">
         <Transport Hostname="sterlingdev.lmggi.com" Port="9086" Protocol="http"/>
         <Transport Hostname="sterlingdev.lmggi.com" Port="9449" Protocol="https">
            <Property Name="keyring" Value="/usr/IBM/WebSphere/Plugins/etc/plugin-key.kdb"/>
            <Property Name="stashfile" Value="/usr/IBM/WebSphere/Plugins/etc/plugin-key.sth"/>
         </Transport>
      </Server>
      <Server CloneID="19vq01lue" ConnectTimeout="5" ExtendedHandshake="false" LoadBalanceWeight="2" MaxConnections="-1" Name="sterlingdevNode02_member02" ServerIOTimeout="900" WaitForContinue="false">
         <Transport Hostname="sterlingdev.lmggi.com" Port="9087" Protocol="http"/>
         <Transport Hostname="sterlingdev.lmggi.com" Port="9450" Protocol="https">
            <Property Name="keyring" Value="/usr/IBM/WebSphere/Plugins/etc/plugin-key.kdb"/>
            <Property Name="stashfile" Value="/usr/IBM/WebSphere/Plugins/etc/plugin-key.sth"/>
         </Transport>
      </Server>
      <PrimaryServers>
         <Server Name="sterlingdevNode01_member01"/>
         <Server Name="sterlingdevNode02_member02"/>
      </PrimaryServers>
   </ServerCluster>
   <ServerCluster CloneSeparatorChange="false" GetDWLMTable="false" IgnoreAffinityRequests="true" LoadBalance="Round Robin" Name="dmgr_sterlingdevCellManager01_Cluster" PostBufferSize="0" PostSizeLimit="-1" RemoveSpecialHeaders="true" RetryInterval="60" ServerIOTimeoutRetry="-1">
      <Server ConnectTimeout="0" ExtendedHandshake="false" MaxConnections="-1" Name="sterlingdevCellManager01_dmgr" ServerIOTimeout="900" WaitForContinue="false"/>
      <PrimaryServers>
         <Server Name="sterlingdevCellManager01_dmgr"/>
      </PrimaryServers>
   </ServerCluster>
   <ServerCluster CloneSeparatorChange="false" GetDWLMTable="false" IgnoreAffinityRequests="true" LoadBalance="Round Robin" Name="server01_sterlingdevNode01_Cluster" PostBufferSize="0" PostSizeLimit="-1" RemoveSpecialHeaders="true" RetryInterval="60" ServerIOTimeoutRetry="-1">
      <Server CloneID="123456789" ConnectTimeout="5" ExtendedHandshake="false" MaxConnections="-1" Name="sterlingdevNode01_server01" ServerIOTimeout="900" WaitForContinue="false">
         <Transport Hostname="sterlingdev.lmggi.com" Port="9080" Protocol="http"/>
         <Transport Hostname="sterlingdev.lmggi.com" Port="9443" Protocol="https">
            <Property Name="keyring" Value="/usr/IBM/WebSphere/Plugins/etc/plugin-key.kdb"/>
            <Property Name="stashfile" Value="/usr/IBM/WebSphere/Plugins/etc/plugin-key.sth"/>
         </Transport>
      </Server>
      <PrimaryServers>
         <Server Name="sterlingdevNode01_server01"/>
      </PrimaryServers>
   </ServerCluster>
   <ServerCluster CloneSeparatorChange="false" GetDWLMTable="false" IgnoreAffinityRequests="true" LoadBalance="Round Robin" Name="server02_sterlingdevNode02_Cluster" PostBufferSize="0" PostSizeLimit="-1" RemoveSpecialHeaders="true" RetryInterval="60" ServerIOTimeoutRetry="-1">
      <Server CloneID="987654321" ConnectTimeout="5" ExtendedHandshake="false" MaxConnections="-1" Name="sterlingdevNode02_server02" ServerIOTimeout="900" WaitForContinue="false">
         <Transport Hostname="sterlingdev.lmggi.com" Port="9081" Protocol="http"/>
         <Transport Hostname="sterlingdev.lmggi.com" Port="9444" Protocol="https">
            <Property Name="keyring" Value="/usr/IBM/WebSphere/Plugins/etc/plugin-key.kdb"/>
            <Property Name="stashfile" Value="/usr/IBM/WebSphere/Plugins/etc/plugin-key.sth"/>
         </Transport>
      </Server>
      <PrimaryServers>
         <Server Name="sterlingdevNode02_server02"/>
      </PrimaryServers>
   </ServerCluster>
   <UriGroup Name="proxy_host_cluster01_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="/sbc/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/sma/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/smcfs/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/services/YIFWebService"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/services/YIFWebService/wsdl/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/*.jsp"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/*.jsv"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/*.jsw"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/j_security_check"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/ibm_security_logout"/>
   </UriGroup>
   <Route ServerCluster="cluster01" UriGroup="proxy_host_cluster01_URIs" VirtualHostGroup="proxy_host"/>
   <UriGroup Name="default_host_cluster01_URIs">
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/commsvc.rest/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/IBM_WS_SYS_RESPONSESERVLET/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/IBM_WS_SYS_RESPONSESERVLET/*.jsp"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/IBM_WS_SYS_RESPONSESERVLET/*.jsv"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/IBM_WS_SYS_RESPONSESERVLET/*.jsw"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/IBM_WS_SYS_RESPONSESERVLET/j_security_check"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/IBM_WS_SYS_RESPONSESERVLET/ibm_security_logout"/>
   </UriGroup>
   <Route ServerCluster="cluster01" UriGroup="default_host_cluster01_URIs" VirtualHostGroup="default_host"/>
   <UriGroup Name="proxy_host_server01_sterlingdevNode01_Cluster_URIs">
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/Landmark_Store/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/sbc/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/sma/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/smcfs/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/services/YIFWebService"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/services/YIFWebService/wsdl/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/*.jsp"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/*.jsv"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/*.jsw"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/j_security_check"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/ibm_security_logout"/>
   </UriGroup>
   <Route ServerCluster="server01_sterlingdevNode01_Cluster" UriGroup="proxy_host_server01_sterlingdevNode01_Cluster_URIs" VirtualHostGroup="proxy_host"/>
   <UriGroup Name="default_host_server01_sterlingdevNode01_Cluster_URIs">
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/commsvc.rest/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/IBM_WS_SYS_RESPONSESERVLET/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/IBM_WS_SYS_RESPONSESERVLET/*.jsp"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/IBM_WS_SYS_RESPONSESERVLET/*.jsv"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/IBM_WS_SYS_RESPONSESERVLET/*.jsw"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/IBM_WS_SYS_RESPONSESERVLET/j_security_check"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/IBM_WS_SYS_RESPONSESERVLET/ibm_security_logout"/>
   </UriGroup>
   <Route ServerCluster="server01_sterlingdevNode01_Cluster" UriGroup="default_host_server01_sterlingdevNode01_Cluster_URIs" VirtualHostGroup="default_host"/>
   <UriGroup Name="proxy_host_server02_sterlingdevNode02_Cluster_URIs">
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/Landmark_Store/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/sbc/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/sma/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/smcfs/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/services/YIFWebService"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/services/YIFWebService/wsdl/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/*.jsp"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/*.jsv"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/*.jsw"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/j_security_check"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/yantrawebservices/ibm_security_logout"/>
   </UriGroup>
   <Route ServerCluster="server02_sterlingdevNode02_Cluster" UriGroup="proxy_host_server02_sterlingdevNode02_Cluster_URIs" VirtualHostGroup="proxy_host"/>
   <UriGroup Name="default_host_server02_sterlingdevNode02_Cluster_URIs">
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/commsvc.rest/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/IBM_WS_SYS_RESPONSESERVLET/*"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/IBM_WS_SYS_RESPONSESERVLET/*.jsp"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/IBM_WS_SYS_RESPONSESERVLET/*.jsv"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/IBM_WS_SYS_RESPONSESERVLET/*.jsw"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/IBM_WS_SYS_RESPONSESERVLET/j_security_check"/>
      <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/IBM_WS_SYS_RESPONSESERVLET/ibm_security_logout"/>
   </UriGroup>
   <Route ServerCluster="server02_sterlingdevNode02_Cluster" UriGroup="default_host_server02_sterlingdevNode02_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>

1 个答案:

答案 0 :(得分:0)

最首选的解决方案是使用 Websphere插件进行负载平衡。 IBM或其他供应商提供的许多产品可用作反向代理/负载均衡器,如IBM ODR,IBM Websphere Proxy Server或IBM Edge Load Balancer e.t.c。

但是,如果由于某种原因您无法使用此类内容,则可以使用Apache 2.X和许多独立的Websphere应用程序服务器(在本例中为WAS1和WAS2)执行以下步骤:

  • 声明代理均衡器,如下所示:

    <Proxy balancer://mylb/>
        BalancerMember http://<WAS1_hostname>:9080 route=WAS1 retry=120 status=+E
        BalancerMember http://<WAS2_hostname>:9080 route=WAS2 retry=120 status=+E
        ProxySet stickysession=JSESSIONID
    </Proxy>
    
  • 在每个WAS控制台中,转到应用程序服务器&gt; server_name&gt; Web容器&gt;自定义属性,设置以下属性,然后重新启动服务器:

  

HttpSessionCloneId = WAS1(即等于上面的路线值)

     

CloneSeparator =

  • 然后根据您的偏好使用平衡器,例如:

    <Location />
            ProxyPass balancer://mylb/mycontextpath/
            ProxyPassReverse balancer://mylb/mycontextpath/
            ProxyPassReverseCookiePath /mycontextpath /
    </Location>
    

这不是一个官方支持的解决方案(你只需要带有mod_proxy和mod_proxy_balancer的apache http服务器),但它应该可以工作。