1. online WLST
2. offline WLST
The only difference here is targeting the WorkManger instance to a Server or a cluster, Online WLST requires
set('Targets',jarray.array([ObjectName('com.bea:Name=appClstr,Type=Cluster')], ObjectName))
set('Targets',jarray.array([ObjectName('com.bea:Name=app1,Type=Server')], ObjectName))
For the Offline WLST the target could be define as follows:
set('Target', app1)The WorkManager configuration can be possible only when you navigate on SelfTuning tree. After navigating with cding to SelfTuning MBean hierarcy. You can list out the SelfTuning tree that consists of the following branch trees, which are allowed us to created new MBeans using create command. - ContextRequestClasses
- FairShareRequestClasses
- ResponseTimeRequestClasses
- Capacities
- MaxThreadsConstraints
- MinThreadsConstraints
- WorkManagers
1. connect to the Administration Server.
2. switch to edit tree
3. configure a class or constraint for the WorkManager.
4. set the target as per your need to a server or to a cluster.
5. configure a new workmananger
6. navigate to the newly configured WorkManager MBean and set the constraint or class which created in the step 3.
7. target the workmanager to a server instance or to a cluster as per the need.
8. Save the changes and activate them.
9. While performing the above steps script code can throw WLSTException, BeanAlreadyExistsException
MaxThreadsConstraintsNow let us see the example for configuring a MaxThreadsConstraints using Online WLSTHere we are going to set the Count value as per the need in the runtime for the MaxThreadConstraint. Better you can also chance to target to Server instance instead of Cluster.
#************************************************************************************
# Configure a WorkManager with MaxThreadsConstrain
#************************************************************************************
from weblogic.descriptor import BeanAlreadyExistsException
try:
#connect('','','t3://adminHost:adminPort')
edit()
startEdit()
c=input('Enter the Max Thread Count: ')
mtc='MaxThreadsConstraint'+str(c)
cd('/SelfTuning/wd1')
cmo.createMaxThreadsConstraint(mtc)
cd('/SelfTuning/wd1/MaxThreadsConstraints/'+mtc)
cmo.setCount(c)
set('Targets',jarray.array([ObjectName('com.bea:Name=appClstr,Type=Cluster')], ObjectName))
cd('/SelfTuning/wd1')
wm = cmo.createWorkManager('pwm1')
cd('/SelfTuning/wd1/WorkManagers/pwm1')
set('Targets',jarray.array([ObjectName('com.bea:Name=appClstr,Type=Cluster')], ObjectName))
cmo.setMaxThreadsConstraint(getMBean('/SelfTuning/wd1/MaxThreadsConstraints/'+mtc))
save()
activate()
except (WLSTException, BeanAlreadyExistsException), e:
print 'Error in script:', e
cancelEdit('y')
else:
disconnect()
Then the outcome looks like below:
wls:/offline> execfile('ConfigWM1.py')
Connecting to t3://adminHost:port with userid system ...
Successfully connected to Admin Server 'padmin' that belongs to domain 'wd1'.
...
You already have an edit session in progress and hence WLST will
continue with your edit session.
Starting an edit session ...
Started edit session, please be sure to save and activate your
changes once you are done.
Enter the Max Thread Count: 45
Saving all your changes ...
Saved all your changes successfully.
Activating all your changes, this may take a while ...
The edit lock associated with this edit session is released
once the activation is completed.
Activation completed
Disconnected from weblogic server: padminCapacity ConstraintNow let us see the example for configuring a capacity constraint using online WLST
#Capacity constraint
#************************************************************************************
from weblogic.descriptor import BeanAlreadyExistsException
try:
connect('','','t3://adminHost:adminPort')
edit()
startEdit()
cd('/SelfTuning/wd1')
cmo.createCapacity('pcap2')
cd('Capacities/pcap2')
set('Count',10)
set('Notes','This will set Capacity constraint')
set('Targets',jarray.array([ObjectName('com.bea:Name=appClstr,Type=Cluster')], ObjectName))
cd('/SelfTuning/wd1')
wm = cmo.createWorkManager('pwm2')
cd('/SelfTuning/wd1/WorkManagers/pwm2')
set('Targets',jarray.array([ObjectName('com.bea:Name=appClstr,Type=Cluster')], ObjectName))
cmo.setCapacity(getMBean('/SelfTuning/wd1/Capacities/pcap2'))
save()
activate()
except (WLSTException, BeanAlreadyExistsException), e:
print 'Error in script:', e
cancelEdit('y')
else:
disconnect()
The output will be like this:
wls:/offline> execfile('ConfigWM2.py')
Connecting to t3://adminHost:port with userid system ...
Successfully connected to Admin Server 'padmin' that belongs to domain 'wd1'.
....
Starting an edit session ...
Started edit session, please be sure to save and activate your
changes once you are done.
Saving all your changes ...
Saved all your changes successfully.
Activating all your changes, this may take a while ...
The edit lock associated with this edit session is released
once the activation is completed.
Activation completed
Disconnected from weblogic server: padmin
Please write back your feedback and comments on this post...
0 comments:
Post a Comment