Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How To Get Cluster Name via Jython in wsadmin?

3,568 views
Skip to first unread message

est...@austinenergy.com

unread,
Jun 29, 2006, 10:35:03 AM6/29/06
to
I'm using the starter info from the Infocenter about ripplestarting a cluster using wsadmin. However, I'm looking for a way for the script to identify the cluster name without the variable being defined or passed as an argument. How can I get the name of the cluster within the script?

# -----------------------------------------------------
# Jython script to ripplestart the cluster from a command line.
# Usage:
# CD to Deployment Manager's bin directory.
# execute ./wsadmin.sh -lang jython -f /opt/AECall/WAS_Config/ripplestart.py
# -conntype SOAP
# -----------------------------------------------------
# Variable Definitions
# -----------------------------------------------------
cellName = AdminControl.getCell()
clusterName = 'ourcluster'
#
#
clusterMgr = AdminControl.completeObjectName("cell=" + cellName + ",type=ClusterMgr,*")
AdminControl.invoke(clusterMgr, 'retrieveClusters')
cluster = AdminControl.completeObjectName("cell=" + cellName + ",type=Cluster,name=" + clusterName + ",*")
AdminControl.invoke(cluster, 'rippleStart')

Ben_

unread,
Jun 29, 2006, 10:56:53 AM6/29/06
to
If you only have one Cluster then you can list the Clusters and pick the
first (and only).

Otherwise, how do you want to start a Cluster without telling its name ?


Dexthor

unread,
Jun 29, 2006, 11:59:32 AM6/29/06
to


Example:
wsadmin>$AdminConfig list ServerCluster
SampleAppC1(cells/Cell01/clusters/SampleAppC1|cluster.xml#ServerCluster_1138735862373)
wsadmin>set cluster
SampleAppC1(cells/Cell01/clusters/SampleAppC1|cluster.xml#ServerCluster_1138735862373)

wsadmin>$AdminConfig showAttribute $cluster {name}
SampleAppC1

You can translate this to Jython syntax :)

-Dexthor.

est...@austinenergy.com

unread,
Jun 29, 2006, 12:16:46 PM6/29/06
to
We do have only one cluster in the cell so listing the members of the cluster and then selecting the only member would work. How does one list the members of the cluster without its name?

Dexthor

unread,
Jun 29, 2006, 1:35:19 PM6/29/06
to

est...@austinenergy.com wrote:
> We do have only one cluster in the cell so listing the members of the cluster and then selecting the only member would work. How does one list the members of the cluster without its name?

wsadmin>$AdminConfig list ServerCluster


SampleAppC1(cells/Cell01/clusters/SampleAppC1|cluster.xml#ServerCluster_1138735862373)
wsadmin>set cluster
SampleAppC1(cells/Cell01/clusters/SampleAppC1|cluster.xml#ServerCluster_1138735862373)

wsadmin>$AdminConfig showAttribute $cluster {name}
SampleAppC1

wsadmin>$AdminConfig showAttribute $cluster {members}
{server1(cells/Cell01/clusters/SampleAppC1|cluster.xml#ClusterMember_1138735862733)
C1M1(cells/Cell01/clusters/SampleAppC1|cluster.xml#ClusterMember_1138735876517)
C1M2(cells/Cell01/clusters/SampleAppC1|cluster.xml#ClusterMember_1138735890725)}

# Once you have configID(Reference) to the Cluster, you can use
'$AdminConfig showAttribute ##ClusterID## {members}' call. If you use
above approach, you dont have to hardcode your Cluster Names, unless
you want to carry out an operation on a specific Cluster.

HTH
Dexthor.

Ben_

unread,
Jun 30, 2006, 12:27:37 PM6/30/06
to
As I said, list them all and take the first of the list.

The following "completeObjectName" will return all of them and thus the only
one in your case:
"cell=<MyCell>,type=Cluster,*"


0 new messages