Transfer server configuration to a cluster

Download

Transfer server configuration to a cluster sample script for Liberty Collectives

Transfer server configuration to a 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 transferConfigToCluster.py sample demonstrates how to call the ClusterManager MBean and FileTransfer MBean from a Jython script to transfer a server.xml file to a cluster managed by a collective controller.

  • The ClusterManager MBean operation used:
    • listMembers
  • The FileTransfer MBean operation used:
    • uploadFile

transferConfigToCluster.py script

This sample script demonstrates how to transfer server configuration, server.xml, to all members of a given Liberty cluster with the ${server.config.dir} target directory. A connection is made to the collective controller located at the given host and port, and the request to transfer server configuration to the cluster is passed to the ClusterManager MBean and FileTransfer MBean.

Note: This sample script replaces the server.xml file for all server members in a cluster with the specified server.xml file and is suitable for a cluster whose members have identical content of their server.xml files. If you have a cluster whose members have server.xml with different contents, do not use this sample script.

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.

Instructions

Required parameters

First parameter The path to the server.xml to transfer.
--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.
--clusterName The name of the static cluster to operate on.

Optional parameters

--help Displays help text.
--debug Displays additional details when an error occurs.

Sample use and resulting messages

	    
&gt;&gt; jython transferConfigToCluster.py path/to/server.xml
   --clusterName=myCluster
   --host=localhost
   --port=9443
   --user=admin
   --password=password
   --truststore=c:\wlp\usr\servers\controller1\resources\security\trust.jks
   --truststorePassword=tsPassword

Connecting to the server...
Successfully connected to the server &quot;localhost:9443&quot;
Pushing the server.xml to server localhost,C:/wlp/usr,member1
Pushing the server.xml to server localhost,C:/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