It is often desirable to "push" configuration changes to nodes in the cell without having to wait for the periodic node sync process to kick in. This becomes a requirement if you want to run some kind of automated testing as part of your configuration/deployment process (which is a very good practice). For example, you may have a build process which runs HTTPUnit tests immediately after the change.
In this case, you really don't want to rely on any artificial "sleeps" and delays in your script, so triggering synchronization programmatically is the best option.
This is actually quite simple to accomplish, as illustrated by the following script:
""" Sync configuration changes with nodes """ # Commit changes to the configuration repository AdminConfig.save() # Obtain deployment manager MBean dm=AdminControl.queryNames("type=DeploymentManager,*") # "syncActiveNodes" can only be run on the deployment manager's MBean, # it will fail in standalone environment if dm: print "Synchronizing configuration repository with nodes. Please wait..." # Force sync with all currently active nodes nodes=AdminControl.invoke(dm, "syncActiveNodes", "true") print "The following nodes have been synchronized: "+str(nodes) else: print "Standalone server, no nodes to sync"
This post is part of the series on WebSphere Application Server administration. Please subscribe to this blog if you'd like to receive updates.
Interestingly enough, the V 7 scriptLibraries contain a method that is almost identical to this routine:
See C:\IBM\WebSphere\AppServer70\scriptLibraries\system\V70\AdminNodeManagement.py and look for the syncActiveNodes() method in line 449.
Great! The articles so far have been full of great material. Glad to hear the serious will continue. Keep ’em coming!
What does the “true” parameter to syncActiveNodes do exactly? My first guess was “perform a full sync”, but I cannot find any documentation on the methods of the DeploymentManager MBean. Any suggestions?
What was I thinking? It is well-documented at http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/topic/com.ibm.websphere.javadoc.doc/public_html/mbeandocs/DeploymentManager.html#syncActiveNodes
Sorry for spamming your comment feed.
I’m using the wsadminlib.py library file for various kinds of admin work, the syncall() is one of those code definitions
Detailed descriptions by Andy Dingsor, one of the co-authors