Monday, 5 November 2018

List the server group memberships of your domain

Last few years I posted on installation of Fusion Middleware. One of the features of FMW12c is the concept of Server Groups. As can be read here: 'Server groups target Fusion Middleware applications and services to one or more servers by mapping defined application service groups to each defined server group.'

For Fusion Middleware Topology I found this article on SOASuite 12c topology from the A-team very helpful.

Server groups are set at creation of the domain. Relating to SOA and OSB it is important to determin where the WebServices Manager Policy Manager is targetted. By default SOA and OSB servers have the SOA-MGD-SVRS or OSB-MGD-SVRS-COMBINED respectively, which means that those servers/clusters have the Policy Manager targetted automatically. If OSB or SOA is the only component in the domain, then this is sufficient. But if you have a domain that combine those components (and/or BAM or MFT), then there should be a separate WSM cluster that target the PM, since you want it targetted to only one cluster. In that case SOA and OSB should have the server groups SOA-MGD-SVRS-ONLY and  OSB-MGD-SVRS-ONLY.

But how to know if you have targetted the proper server groups to your servers? You can use the getServerGroups([serverName]) wlst command for that.

I created a simple wlst script for it. Save the following script as listServerGroups.py. Change the domainHome variable at the top of the scripts to the location of your domain (I did not bothered to parameterize this...):


#############################################################################
# List ServerGroups for a domain
#
# @author Martien van den Akker, Darwin-IT Professionals
# @version 1.0, 2018-11-05
#
# Usage:
#   wlst listServerGroups.py
#
# When       Who                      What
# 20181105   Martien van den Akker    Create
#
#############################################################################
#
import sys, traceback
scriptName = sys.argv[0]
#
domainHome='/data/oracle/config/domains/soa_domain'
#
#
def main():
  readDomain(domainHome)
  cd('/')
  allServers=cmo.getServers()
  if (len(allServers) > 0):
    for wlserver in allServers:
      wlserverName = wlserver.getName()
      print('Groups of server: '+wlserverName)
      serverGroups=getServerGroups(wlserverName)
      for serverGroup in serverGroups:
        print('..'+serverGroup)
#
# Main
main() 

The getServerGroups() command is an wlst offline commmand, so you need to read the domain for it.
You can remove groups and or set new groups using the setServerGroups() command. If you do so, you need to update the domain (updateDomain()) and then close the domain (closeDomain()). And of course you need to restart your domain. This means by the way, also the AdminServer, since it needs to re-read the domain. It is even recommended to stop the domain before updating it in offline mode.

By the way, my scripts to create a FMW Domain also make use of the setServerGroups() command, as can be read in this article, but if you reuse them, make sure you have the correct ServerGroups set (Maybe I should parameterize those too).


No comments :