Prerequisites
In this exciting example 😊 new learning about how to use the dynamic cluster in the latest version of WebLogic 12c [12.1.2] and above this was introduced for WebLogic on Cloud computing. To workout this you must configure a Server template when you give the maximum number of cluster servers these managed server automatically increased. When you decrease it the number of managed servers come to SHUTDOWN state as expected. To do same task from the automation using WLST prompt you need to use the following two functions:
- scaleUp increase the number of managed servers in the cluster
- scaleDown to decrease the number of managed servers in the cluster.
Dynamic Cluster configuration on WebLogic Domain |
now let's do the automation exercise
The above generic WLST script can be executed as shown below:
You could also double confirm this from your WebLogic Admin Console work-area when you select clustser in the Environment of under your Domain .
Suggestion for future enhancements to the above script you can do following:
scaleUp execution for single server:
Scale down weblogic cluster
Hope you enjoyed this post, Stay tune to this blog post and share with your friends techies...
# Dated : 4th Feb 2016 # ScriptName : dynamicCluster.py # Purpose : # This script will create server template and using that # configures a dyanamic cluster def createServer_Template(tmpName, basePort, sslPort, machine): print 'creating server tempalte for '+tmpName cd('/') cmo.createServerTemplate(''+tmpName) cd('/ServerTemplates/'+tmpName) cmo.setListenPort(int(basePort)) cd('/ServerTemplates/'+tmpName+'/SSL/'+tmpName) cmo.setListenPort(int(sslPort)) cd('/ServerTemplates/'+tmpName) cmo.setMachine(None) def create_dynamicCluster(clustrName, tmpName, prefix): print 'Creating dynamic cluster: '+clustrName cd('/') cmo.createCluster(clustrName) cd('/Clusters/'+clustrName) cmo.setClusterMessagingMode('unicast') cd('/ServerTemplates/'+tmpName) cmo.setCluster(getMBean('/Clusters/'+clustrName)) cd('/Clusters/'+clustrName+'/DynamicServers/'+clustrName) cmo.setServerTemplate(getMBean('/ServerTemplates/'+tmpName)) cmo.setDynamicClusterSize(2) cmo.setMaxDynamicClusterSize(8) cmo.setCalculatedListenPorts(true) cmo.setCalculatedMachineNames(true) cmo.setCalculatedListenPorts(true) cmo.setServerNamePrefix(prefix) def main(): connect("weblogic","welcome1","t3://192.168.33.100:6100") edit() startEdit() print 'Creating server templates...' # creating server templates createServer_Template('app_tier_tmp', 7120, 8120, 'mydev') createServer_Template('web_tier_tmp', 6120, 9120, 'mydev') # Machine already configured create_dynamicCluster('app_dclustr', 'app_tier_tmp','app_server0') create_dynamicCluster('web_dclustr', 'web_tier_tmp','web_server0') print 'Dynamic cluster configuration completed...' activate() main()
The above generic WLST script can be executed as shown below:
You could also double confirm this from your WebLogic Admin Console work-area when you select clustser in the Environment of under your Domain .
Dynamic Cluster configuration in WebLogic 12.2.1 Domain |
Suggestion for future enhancements to the above script you can do following:
- create a properties file and pass all the main program required arguments
- Cluster Message Mode can be dynamic
- Machine per template can be set dynamic
Elastic Cluster on-demand scale up
In the WLST prompt you can test it as :
In the WLST prompt you can test it as :
scaleUp ("app_dclustr",1, true, true)
scaleUp execution for single server:
ScaleUp in WLST Execution |
scaleDown('app_dclustr',2,true,true)
Scale down weblogic cluster
Scale Down cluster size in WLST |
Hope you enjoyed this post, Stay tune to this blog post and share with your friends techies...
Waiting for your comments and suggestions!!