Anyone tried Cluster automation with WLST?

青春壹個敷衍的年華 提交于 2019-12-24 07:19:16

问题


Most of the production env might need a automation script for Clusters. Reason is whenever there is a need of enhance the sites need to add new cluster to existing domain. When there is a decommissioned a physical site that needs removal of cluster from the domain. There is also possibility of "Growth" of Cluster (adding managed servers to a cluster). Finally there is also need of decommission of machines which requires removal of servers from the cluster. Menu 1. Add a Cluster 2. Del a Cluster 3. Add a server to Cluster 4. Del a server from Cluster

Please share your thoughts and suggestions...

Thanks in advance.


回答1:


I'm actually doing exactly that and it works fine.

You'll have to add the inital

edit()
startEdit()

and to save

save()
activate(block='true')

as well as exception handling but the functions are pretty simple:

Add a server to cluster:

managedServer = create(ServerName,'Server')
managedServer.setListenPort(ListenPort)
managedServer.setCluster(Clustername)
managedServer.setMachine(Machinename)

Delete server from cluster (and the server, optional):

serverMBean = getMBean("Servers/"+ServerName)
serverMBean.setCluster(None)
serverMBean.setMachine(None)
delete(ServerName,'Server')

Add a cluster (you can also use the same method as creating a server -> create(name, 'Cluster'):

cd('/')
cmo.createCluster('Cluster-0')
cd('/Clusters/Cluster-0')
cmo.setClusterMessagingMode('unicast')
...

Delete a cluster works the same way as deleting a server, you should power them down first though.

In general you can use the admin console to perform the desired actions and the record button at the top allows you to generate a wlst script which does exactly what you do in the admin console.



来源:https://stackoverflow.com/questions/6166681/anyone-tried-cluster-automation-with-wlst

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!