Update config to cluster

Download

Update config to cluster sample script for Liberty Collectives

Update config to cluster

Description

In IBM WebSphere Application Server Network Deployment Version 8.5.5, Liberty profile has introduced the Liberty collective feature. Refer to information about collectives in the IBM WebSphere Application Server Version 8.5.5 information center for more specifics.

The updateClusterConfig.py sample demonstrates how to call the RoutingContext MBean, ClusterManager MBean and FileTransfer MBean from a Jython script to push application files to a cluster managed by a collective controller.

  • The RoutingContext MBean operation used:
    • assignServerContext
  • The ClusterManager MBean operation used:
    • listMembers
  • The FileTransfer MBean operations used:
    • uploadFile
    • downloadFile

updateClusterConfig.py script

The updateClusterConfig sample script demonstrates how to download and upload a server configuration file to all cluster members with the given cluster name. A connection is made to the collective controller located at the given host and port. The list of cluster members is then obtained using the ClusterManager MBean and the request to download or upload the file is passed to the FileTransfer MBean.

Because this script uses the FileTransfer MBean to upload one or more files, the remoteFileAccess element must be specified in the server.xml of the server that will receive the file(s). Without this you will get a file permission error when using the script. Here is an example of a remoteFileAccess element:

<remoteFileAccess>

<writeDir>${server.config.dir}</writeDir>

</remoteFileAccess>

For further information and examples for remoteFileAccess, please visit the Information Center for “WebSphere Application Server V8.5 Liberty profile” and search for “List of provided MBean”, “remoteFileAccess” or “Configuration elements in the server.xml” information center topics.

File transfer requires remote execution and access (RXA). Before running this sample script, ensure the target system(s) are configured for remote access. For more information on the remote execution and access requirements and setup, refer to Requirements for using Remote Execution and Access (RXA) in the information center.

This script can be used in conjunction with the transferAppToCluster.py script which pushes the application file to the cluster members. You can also use this script to modify member configurations by getting each member’s server.xml and then pushing them back to the members, after the member files have been modified, manually.

Instructions

Required parameters

First parameter get or put.
--clusterName The name of the cluster to get or put the configuration.
--truststore The path to the truststore to be used when establishing a connection to the collective controller.
--truststorePassword The password for the truststore specified by the --truststore parameter.
--host The host name where the collective controller is running.
--port The https port where the collective controller is listening.
--user The user name to use when connecting to the collective controller.
--password The password to use when connecting to the collective controller.

Optional parameters

--help Displays help text.
--debug Displays additional details when an error occurs.
--localDir The path on the local machine where the server.xml files can be stored. If this parameter is not supplied, the current directory will be used.

Sample use and resulting messages

	    
>> jython updateClusterConfig.py get
   --clusterName=cluster1
   --localDir=C:/Liberty/downloadedFiles
   --host=localhost
   --port=9443
   --user=admin
   --password=adminpwd
   --truststore=C:/Liberty/wlp/usr/servers/controller1/resources/security/trust.jks
   --truststorePassword=password

Connecting to the server...
Successfully connected to the server "localhost:9443"
Getting configuration for server localhost,C:/Liberty/wlp/usr,member1
Getting configuration for server localhost,C:/Liberty/wlp/usr,member2

	  
	    
>> jython updateClusterConfig.py put
   --clusterName=cluster1
   --localDir=C:/Liberty/downloadedFiles
   --host=localhost
   --port=9443
   --user=admin
   --password=adminpwd
   --truststore=C:/Liberty/wlp/usr/servers/controller1/resources/security/trust.jks
   --truststorePassword=password

Connecting to the server...
Successfully connected to the server "localhost:9443"
Putting configuration for server localhost,C:/Liberty/wlp/usr,member1
Putting configuration for server localhost,C:/Liberty/wlp/usr,member2

	  

Notes

The following additional sample scripts provide shared code which is used by this sample:

  • wlp_arguments.py
  • wlp_cluster.py
  • wlp_serverConfig.py