Wednesday, May 12, 2010

How to install an application?

Use wsadminlib's method installApplication().

Here is the method signature. The parameter names are straightforward, and the pydoc is pretty good. The list of servers is meant to specify individual non-clustered servers. If a server is part of a cluster, just specify the cluster name.

def installApplication( filename, servers, clusternames, options )

Clusters

First let's install an app on a cluster of servers. Define the name of the ear file, and the name of the cluster. Then install the app, specifying an empty list for individual servers, and no options.

filename = '/tmp/pxyapps.ear'
clusternames = [ 'cluster1' ]
installApplication( filename, [], clusternames, None )


After saving the config, we can browse to the admin console, look at the app's mappings, and see it worked:

Individual servers

Next let's install an app on an individual non-clustered server. Define the server in a list of dictionaries containing the node name and server name. This time we specify an empty list for the clusternames.

Wednesday, April 21, 2010

How to create a cluster and servers?

Use wsadminlib methods createCluster() and createServerInCluster().

First create a cluster, specifying the cell name and cluster name:

createCluster( 'cell1', 'cluster1')

Then create servers, specifying the cluster name, node name, and server name:

createServerInCluster( 'cluster1', 'node1', 'server1')
createServerInCluster( 'cluster1', 'node1', 'server2')


That was easy. We created one cluster with two servers. This screenshot shows the two servers with the cluster name in the Admin Console.

It's also easy to create a replication domain and enable session replication with these same commands. If you look at the two method signatures in wsadminlib.py, you'll see optional parameters for replication. They are disabled by default, and you can override them as follows:

Friday, April 9, 2010

Who wrote wsadminlib.py?

wsadminlib.py was originally created by two IBM product developers in 2006. They shared it with teammates and it grew into an internal community project with several dozen volunteer contributors thus far.

Click on the thumbnail image to see the list of people who have contributed to the first version published on developerWorks (and who gave permission to publish their names).

Friday, April 2, 2010

How to set a custom property on a channel?

Use wsadminlib's method setChannelCustomProperty().

Before we start, here is an example of channel custom properties in the admin console: Click Application Servers-> server1-> Web container settings-> Web container transport chains-> WCInboundDefault-> Web container inbound channel (WCC2)-> Custom properties. I have no idea what a channel is, but I can show you how to set a custom property on one...

Method setChannelCustomProperty() allows us to specify the channel either by an end point name or the channel name. Take a look at the method in wsadminlib, where there is actually good pydoc to explain the parameters.

The first five parameters are required, in the specified sequence. The last two, endPointName and channelName, are optional and have defaults. You must specify exactly one of them.

So let's add a hypothetical custom property, enablePlayaDust=true, by specifying the channel name. Create a python script file named setChannelCustProp.py: