Sunday, 2 December 2012

Control Websphere clusters with AdminControl


I needed to start a four cluster environment the other day and used AdminControl to do this as follows...

1./ Start wsadmin (connecting to the Deployment Manager)
2./ Get the MBean references for each Cluster with AdminControl.queryNames. For example, in my case I'm doing this on Process Server so I have a cluster named RMRS.Messaging. To find the MBean for this cluster I can run the following...

m_cluster = AdminControl.queryNames('type=Cluster,name=RMRS.Messaging,*')
or, because I'm lazy I could wildcard the name as follows
m_cluster = AdminControl.queryNames('type=Cluster,name=*Messa*,*')

(Note, the wildcard doesn't seem to work on node names)

Do this for al lof the Clusters you need to start.

3./ Start each cluster with AdminControl.invoke. For example, to start my messaging cluster I would use
AdminControl.invoke(m_cluster, "start")

4./ To check whether the cluster members have actually started, you can attempt to get an MBean for each server, again using AdminControl.queryNames. For example, if I need to check whether the RMRS.Messaging member has started on node1 I would run ...
AdminControl.queryNames('type=Server,name=*Messaging*,node=node1,*')

(Notice the type is now Server as opposed to Cluster)

If an MBean is returned by this command it means the Cluster member is running, if nothing is returned it means the Cluster member is not running.

One thing I found confusing is that the rule stating that an MBean is returned if the entity being queried is running does not appear to apply to Clusters. I.e. at the beginning of this post you'll remember I obtained the MBean of a cluster who's members were not running, therefore you could say the cluster was not running.

No comments:

Post a Comment