可以使用 wsadmin 工具和脚本编制来查询集群状态。
开始之前
开始本任务前,wsadmin 工具必须正在运行。有关更多信息,请参阅“使用 wsadmin 脚本编制来启动 wsadmin 脚本编制客户机”主题。
过程
- 标识 Cluster MBean,并将其指定给 cluster 变量。
使用 Jacl:
set cluster [$AdminControl completeObjectName cell=mycell,type=Cluster,name=cluster1,*]
使用 Jython:
cluster = AdminControl.completeObjectName('cell=mycell,type=Cluster,name=cluster1,*')
print cluster
此命令返回 Cluster MBean。示例输出:
WebSphere:cell=mycell,name=cluster1,mbeanIdentifier=Cluster,type=Cluster,process=cluster1
- 查询集群状态。
使用 Jacl:
$AdminControl getAttribute $cluster state
使用 Jython:
AdminControl.getAttribute(cluster, 'state')
此命令返回运行时状态属性的值。