Automatic modification of WebSphere Plugin (Primary / BackupServers) to maintain two-line concept

Automatic modification of WebSphere Plugin (Primary / BackupServers) to maintain two-line concept

Hi,

in larger highly available environments you may know an architectural concept called “two-line approach”. Behind a load balancer you have two lines that can be shutdown / started independent from each other. This is very practical if you need to do maintenance to the operation system or other system related things without the necessity to always shutdown the complete environment.

In such a “two-line” environment, only one instance should be responsible for loadbalancing the user load – in this case this is a loadbalancer.

If you setup a multinode environment with two or more nodes and HTTP Servers load balancing will not only take place on the load balancer but also within the WebSphere Plugin between both WebSphere nodes defined in the plugin-cfg.xml (example):

<PrimaryServers>
   <Server Name="IC55Node01_InfraCluster_server1"/>
   <Server Name="IC55Node02_InfraCluster_server2"/>
</PrimaryServers>

You balance the load via load balancer and WebSphere Plugin! This is contra productive and makes error analysis more complicated:

Bildschirmfoto 2016-07-06 um 10.59.15

There is a great approach to use the “BackupServers” definition within the plugin-cfg.xml (example):

<PrimaryServers>
   <Server Name="IC55Node01_InfraCluster_server1"/>
</PrimaryServers>
<BackupServers>
   <Server Name="IC55Node02_InfraCluster_server2"/>
</BackupServers>

This definition causes the following behavior:

  • If IC55Node01_InfraCluster_server1 is responsive, the load will ALWAYS be routed to this node
  • If IC55Node01_InfraCluster_server1 is down, the load will be routed to the other Node (IC55Node02_InfraCluster_server2)

Bildschirmfoto 2016-07-06 um 10.59.23

The main problem comes into play if you`re using automatic plugin generation / propagation…

Even though it is possible to define the BackupServers role per Application Server this does not help you much further:

Bildschirmfoto 2016-07-06 um 08.58.25

When choosing

  • Primary for *server1
  • Backup for *server2

then this setting would only match for the first HTTP Server… The second HTTP Server (second line) needs another configuration vise-versa (example):

<PrimaryServers>
   <Server Name="IC55Node02_InfraCluster_server2"/>
</PrimaryServers>
<BackupServers>
   <Server Name="IC55Node01_InfraCluster_server1"/>
</BackupServers>

You can now change this setting manually each time you regenerate the plugin (deactivate automatic regeneration / propagation). But this is too erroneous and not really smart.

My colleague Sebastian Küthe developed a really cool script that does this job automatically 😉

modifyWasPlugin.sh

Please note that using the script is at your own risk! You should carefully test the script! It might need some more error handling!

This script has four different operation modes:

  • ./modifyWasPlugin.sh -m –> Manual selection process
  • ./modifyWasPlugin.sh -a –> Automatic execution process. Modify array “backupServerList” in this script.
  • ./modifyWasPlugin.sh -sb SERVER –> Remove SERVER from PrimaryServer definition and declare it as BackupServer
  • ./modifyWasPlugin.sh -l –> List all servers declared as PRIMARY

Preparation

Open the script using vi and modify the variable “fileToUse” to match your plugin-cfg.xml

#!/bin/bash
#####################################################################
## Script to modify WAS Plugin Primary / Backup Server definitions
## Version: 1.0.2016-06-13
##
## copyright 2016 GIS AG, Sebastian Kuethe
##
#####################################################################
## variable definition

fileToUse="/ibm/WebSphere/Plugins/config/webserver1/plugin-cfg.xml"
debug=false

declare -a backupServerList=(

)
...

Now you can choose the different modes either manual or automatic. I prefer the automatic mode. An Example how to do this:

I want IC HTTP 1 to serve ICNode01 so I prepare the script like this:

#!/bin/bash
#####################################################################
## Script to modify WAS Plugin Primary / Backup Server definitions
## Version: 1.0.2016-06-13
##
## copyright 2016 GIS AG, Sebastian Kuethe
##
#####################################################################
## variable definition

fileToUse="/ibm/WebSphere/Plugins/config/webserver1/plugin-cfg.xml"
debug=false

declare -a backupServerList=(
           IC55Node02_InfraCluster_server2
           IC55Node02_Cluster1_server2
           IC55Node02_Cluster2_server2
) 
...

On the second HTTP Server I want IC HTTP 2 to serve ICNode02 so I prepare the script like this:

#!/bin/bash
#####################################################################
## Script to modify WAS Plugin Primary / Backup Server definitions
## Version: 1.0.2016-06-13
##
## copyright 2016 GIS AG, Sebastian Kuethe
##
#####################################################################
## variable definition

fileToUse="/ibm/WebSphere/Plugins/config/webserver2/plugin-cfg.xml"
debug=false

declare -a backupServerList=(
           IC55Node01_InfraCluster_server1
           IC55Node01_Cluster1_server1
           IC55Node01_Cluster2_server1
) 
...

Now you need to execute the script on both nodes:

 ./modifyWasPlugin.sh -a

The result – plugin-cfg.xml for Node01:

...
      </Server>
      <PrimaryServers>
         <Server Name="IC55Node01_InfraCluster_server1"/>
      </PrimaryServers>
      <BackupServers>
         <Server Name="IC55Node02_InfraCluster_server2"/>
      </BackupServers>
   </ServerCluster>
...
...
      </Server>
      <PrimaryServers>
         <Server Name="IC55Node01_Cluster1_server1"/>
      </PrimaryServers>
      <BackupServers>
         <Server Name="IC55Node02_Cluster1_server2"/>
      </BackupServers>
   </ServerCluster>
...   
...
      </Server>
      <PrimaryServers>
         <Server Name="IC55Node01_Cluster2_server1"/>
      </PrimaryServers>
      <BackupServers>
         <Server Name="IC55Node02_Cluster2_server2"/>
      </BackupServers>
   </ServerCluster>
...

The result – plugin-cfg.xml for Node02:

...
 </Server>
      <PrimaryServers>
         <Server Name="IC55Node02_InfraCluster_server2"/>
      </PrimaryServers>
      <BackupServers>
         <Server Name="IC55Node01_InfraCluster_server1"/>
      </BackupServers>
   </ServerCluster>
...   
...
</Server>
      <PrimaryServers>
         <Server Name="IC55Node02_Cluster1_server2"/>
      </PrimaryServers>
      <BackupServers>
         <Server Name="IC55Node01_Cluster1_server1"/>
      </BackupServers>
   </ServerCluster>
...   

...
     </Server>
      <PrimaryServers>
         <Server Name="IC55Node02_Cluster2_server2"/>
      </PrimaryServers>
      <BackupServers>
         <Server Name="IC55Node01_Cluster2_server1"/>
      </BackupServers>
   </ServerCluster
...

You can now define the script to run each e.g. ten minutes or more often in cron:

*/10 * * * * /ibm/utils/modifyWasPlugin.sh > /dev/null

If you now think of the large deployment model of IBM Connections such a script can save you a LOT of work 😉

One thought on “Automatic modification of WebSphere Plugin (Primary / BackupServers) to maintain two-line concept

Leave a Reply

Your email address will not be published. Required fields are marked *