如何使用Jython脚本自动设置WebSphereApplicationServer中的首选协调器服务器?

如何使用Jython脚本自动设置WebSphereApplicationServer中的首选协调器服务器?,websphere,jython,wsadmin,Websphere,Jython,Wsadmin,我们正在尝试使用Jython代码并使用wsadmin实用程序运行它,以自动化服务器JVM列表的首选协调器。手动方法是登录到管理控制台并选择服务器>核心组>Coure组设置>DefaultCoreGroup>首选协调器服务器 通过在管理控制台中进行更改并使用显示要使用的Jython代码的命令帮助链接,我们已经自动化了大部分WebSphereApplicationServer构建。此任务没有该功能 代码如下所示: AdminTask.listschains'cells/wamt13Cell01/no

我们正在尝试使用Jython代码并使用wsadmin实用程序运行它,以自动化服务器JVM列表的首选协调器。手动方法是登录到管理控制台并选择服务器>核心组>Coure组设置>DefaultCoreGroup>首选协调器服务器

通过在管理控制台中进行更改并使用显示要使用的Jython代码的命令帮助链接,我们已经自动化了大部分WebSphereApplicationServer构建。此任务没有该功能

代码如下所示: AdminTask.listschains'cells/wamt13Cell01/nodes/wamt13CellManager01/servers/dmgr | server.xmlTransportChannelService_1',“[-acceptorFilter DCSInboundChannel]”


完成后,我们希望为首选协调器服务器框设置JVM。

使用下面的代码段为coregroup配置首选协调器服务器

在运行脚本以根据环境配置分别更新首选服务器名称和核心组名称之前,更新变量coreGroupPrefServer&coreGroupName

#User Input: Define preferred server name below
coreGroupPrefServer='server1'


#Get config id of the preferred coreGroup Server
coreGroupPrefServerId=AdminConfig.getid('/CoreGroupServer:%s' %coreGroupPrefServer)

#Define coreGroupName below, default is 'DefaultCoreGroup'
coreGroupName='DefaultCoreGroup'

#Get config id for the coreGroup defined above
coreGroupId=AdminConfig.getid('/CoreGroup:%s' %coreGroupName)


#Remove preferredCoordinatorServers if any already configured
AdminConfig.unsetAttributes(coreGroupId, '[preferredCoordinatorServers]')

#Set the user provided coreGroupPrefServer as the preferredCoordinatorServer for the coreGroup
AdminConfig.modify(coreGroupId, '[[preferredCoordinatorServers %s]]' %coreGroupPrefServerId)

#Save the changes
AdminConfig.save()