A brief guide to the collection of sample admin scripts which demonstrate the administrative capabilities of collectives and clusters.

Using the collective and cluster sample admin scripts

Description

IBM WebSphere Application Server Network Deployment Version 8.5.5, Liberty profile has introduced the Liberty collective feature. This page will guide you through using a series of samples, taking you through the steps from creating a simple collective to maintaining a complete cluster.

Requirements & Environment Setup

The sample admin scripts are written for Jython, and have been tested with Jython 2.5.3. The Jython runtime is not shipped with Liberty, but is available from jython.org.

Two environment variables must be set in order for Jython to find the required libraries necessary for these samples.

Windows

# set CLASSPATH=%WLP_INSTALL_DIR%clients/restConnector.jar
# set JYTHONPATH=%WLP_INSTALL_DIR%clientsjython;%SAMPLE_SCRIPTS%/lib
                     
                 

Linux

# export CLASSPATH=$WLP_INSTALL_DIR/clients/restConnector.jar
# export JYTHONPATH=$WLP_INSTALL_DIR/clients/jython:$SAMPLE_SCRIPTS/lib
                     
                 

For versions of jython earlier than 2.5, it may be necessary to invoke jython with the command argument -Dpython.path=$JYTHONPATH as it does not support the JYTHONPATH environment variable.

Create and Manage a Simple Topology

Create the Topology

First, you need to setup a simple topology of a collective controller and a collective member. The collective controller provides the control point for member servers within the collective. For instructions for creating a collective, see the Configuring a Liberty collective in the IBM WebSphere Application Server Version 8.5.5 information center.

Enable File Transferring

Several of these sample scripts use the FileTransfer MBean to upload one or more files, the remoteFileAccess element must be specified in the server.xml of the server(s) that will receive the file(s). Here is an example of a remoteFileAccess element:

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

Without this configuration you will get a file permission error when using the script. For further information and examples for remoteFileAccess, please refer to List of provided MBeans or Configuring elements in the server.xml file in the information center for IBM WebSphere Application Server Version 8.5.5 Liberty profile.

Remote Execution Access

File transfer and server commands require remote execution and access (RXA). Before running the sample scripts, 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.

Manage the Topology

Now that you have created a controller and member, and configured your environment, you can use scripting to perform basic tasks such as start the member (startServer.py), stop the member (stopServer.py) or updating the member’s configuration (updateServerConfig.py).

Deploy an Application

With a running member, you can now install an application to the member. The manageAppOnServer.py sample script provides an example for installing and uninstalling an application using a Jython script.

Expand the Collective

The deployMembers.py sample script allows you to deploy additional member servers into your collective by pushing out the members defined in an archive.

Create and Manage a Cluster of Collective Members

Create the Cluster

As your use of the collective grows, you will likely want to run applications in a cluster of members. To enable clustering in your collective, see the Configuring a Liberty server cluster in the information center.

Manage the Cluster

With the cluster created, it can now be managed from the controller. You can view all of the configured clusters (listClusterNames.py), list the cluster members of a cluster (listClusterMembers.py), and start and stop an entire cluster from the controller as the startCluster.py and stopCluster.py sample scripts demonstrate.

Deploy an Application to the Cluster

After you have a cluster, you may want to deploy an application into the cluster. The transferAppToCluster.py and manageAppOnCluster.pyscripts demonstrate how this can be accomplished with Jython.

Deploy Configuration Changes to the Cluster

From time to time, it may be necessary to push configuration changes to the server.xml file of the members of a cluster. The transferConfigToCluster.py and updateClusterConfig.py sample scripts offer two approaches.

Generate the IBM HTTP Server Plugin

Finally, you may want to configure your cluster for communication with an IBM HTTP Server. The genClusterPlugin.py sample script demonstrates using Jython scripting to complete this task.

For a complete, step-by-step, guide to building an application cluster see Lab: Build and Administer Your Own Liberty Application Cluster.

13 comments on"A guide to the sample admin scripts"

  1. Hi Team,

    Does anyone have the updated working link for the below referring contents?
    http://www.ibm.com/developerworks/websphere/library/samples/SampleScripts.html

  2. Hello,

    I’m trying to run the deployMembers.py using jython and i’m seeing this error

    Traceback (most recent call last):
    File “deployMembers.py”, line 52, in
    import wlp_arguments as arguments
    ImportError: No module named wlp_arguments

    • Roger Cundiff June 12, 2019

      The download includes a lib directory with shared utility scripts, including wlp_arguments.py. The lib directory must be included in the JYTHONPATH environment variable as shown in the “Requirements and Environment Setup” section (note the missing ‘/’ in the Windows example before “lib”).
      The error you are getting indicates the lib directory is either not included in JYTHONPATH or the directory does not exist or the
      wlp_arguments.py file is missing from it.

    • The download includes a lib directory with shared utility scripts, including wlp_arguments.py. The lib directory must be included in the JYTHONPATH environment variable as shown in the “Requirements and Environment Setup” section (note the missing ‘/’ in the Windows example before “lib”). The error you are getting indicates the lib directory is either not included in JYTHONPATH or it does not exist or the wlp_arguments.py file is missing from it.

  3. hari Kiran March 20, 2018

    Do you we have similar scripts for Full Profile? if yes, please let me know

  4. As soon as I run this I get the following error:

    >>> from restConnector import JMXRESTConnector
    Traceback (innermost last):
    File “”, line 1, in ?
    File “/AppServer/clients/jython/restConnector.py”, line 10, in ?
    ImportError: no module named ibm
    >>> ^D

    • Michael C Thompson June 15, 2016

      That error suggests jython can not find the restConnector.jar. What version of Liberty are you using, and did you set the CLASSPATH to include the restConnector.jar?

  5. Hello, I’m getting page not found error while trying to download sample scripts. Could you please provide me exact location of sample scripts.

Join The Discussion

Your email address will not be published. Required fields are marked *