Transfer an application to a cluster
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 transferAppToCluster.py sample demonstrates how to call the RoutingContext MBean, ClusterManager MBean and FileTransfer MBean from a Jython script to push application files to the cluster.
- The RoutingContext MBean operation used:
- The ClusterManager MBean operation used:
- The FileTransfer MBean operation used:
This sample script demonstrates how to push an application to all cluster members with the given cluster name. A connection is made to the collective
located at the given host and port, then the list of cluster members is obtained using the ClusterManager MBean and the request to upload the application 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:
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.
Running the script pushes the application file to the apps directory of all the cluster members.
You still must make a configuration update to the server.xml of each server member to add the application element and any other elements that the application
needs. Automation of such changes can be seen in other sample scripts such as updateClusterConfig.py or transferConfigToCluster.py.
pathToApp The path to an application file to be transferred. --clusterName The name of the cluster to receive the application. --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.
--help Displays help text. --debug Displays additional details when an error occurs.
Sample use and resulting messages
>> jython transferAppToCluster.py C:/installableApps/snoop.war --truststore=C:/Liberty/wlp/usr/servers/controller1/resources/security/trust.jks --truststorePassword=secret --host=localhost --port=9443 --user=admin --password=adminpwd --clusterName=cluster1 Connecting to the server... Successfully connected to the server "localhost:9443" Pushing the application to server localhost,C:/Liberty/wlp/usr,member1 Pushing the application to server localhost,C:/Liberty/wlp/usr,member2
The following additional sample scripts provide shared code which is used by this sample: