Search This Blog

Showing posts with label WLST Offline. Show all posts
Showing posts with label WLST Offline. Show all posts

Saturday, April 8, 2017

WebLogic 12c Cluster Domain configuration using WLST offline

Objective of this script is to Leverage the time takes to configure the WebLogic Domain and after starting the admin server then following list need to be configured for HA/reliability.
Everytime I work on new project there is a need of creation of the clustered domain. From my past experiences collected all basic requirements together list them over here.

  • AdminServer configuration includes Name, Listen Address, ListenPort
  • User credentials username, password
  • After writing basic domain going for create machine which include Name, type of machine
  • Nodemaager includes NMTypes such as plain, ssl, hosted node, nodemanager port
  • Managed servers have Name, ListenAddress, ListenPort, set machine
  • Cluster includes name, ClusterAddress, Servers part of the cluster interesting part here
Assumptions for this task:

WebLogic 12.2.1 cluster domain creation with WLST
WLST Configuring WebLogic Cluster Domain


In the script as per my convenience some of them are hardcoded, My hardcoded values:
  1. Managed Server list
  2. Cluster list
In this script lots of Python sequence functions are used.

  • List index, 
  • Dictionary keys
  • String startwith

Lets begin the fun of WLST HERE...
# purpose:  Create the domian with the one Admin Server along with the
# two managed servers in each cluster. app_cluster, web_cluster
# Assumption here all managed servers runs on the same machine
# Modified date: 07-April-2017
# File name     :       create_clusterdomain.py
# Dependencies  :       cluster_domain.properties
# Note this names of managed servers, cluster, hostname all hard coded
#
def printline(s):
    print "-"*10 + s

loadProperties('/u01/app/software/scripts/pybin/cluster_domain.properties')

# Created a Cluster and assaign the servers to that cluster
# Create a domain from the weblogic domain template

WLHOME=os.environ["WL_HOME"]
readTemplate(WLHOME+'/common/templates/wls/wls.jar')
printline("reading template completed")

# Configure the Administration Servers with out using SSL Port

cd('Servers/AdminServer')
set('ListenAddress',WLSAdminIP)
set('ListenPort', int(AdminPort))

printline("AdminServer ListenAddress, port set")

cd('/')
cd('Security/base_domain/User/weblogic')
cmo.setPassword(AdminPasswd)
printline("User credentials set")

setOption('OverwriteDomain', 'true')
writeDomain(DomainPath+'/'+DomainName)
printline("Domain creation done.")

closeTemplate()
readDomain(DomainPath+'/'+DomainName)
machines={'myM100':'192.168.33.100', 'myM110':'192.168.33.110'}

for m in machines.keys():
        cd('/')
        create(m, 'UnixMachine')
        cd('Machine/' + m)
        create(m, 'NodeManager')
        cd('NodeManager/' + m)
        set('ListenAddress', machines[m])
        set('NMType','ssl')

# Create the Managed Servers and  configuration them
ManagedServerList=['app01','app02','web01','web02']

app_ca=""
web_ca=""
for s in ManagedServerList:
        cd('/')
        create(s,'Server')
        cd('Server/'+s)
        i=ManagedServerList.index(s)
        lp=8101+i
        set('ListenPort', int(lp))
        j=int(s[-1])
        m=machines.keys()[j-1]
        set('ListenAddress', machines[m])
        set('Machine', m)

        if s.startswith('app') :
                if j%2==0:
                        app_ca+=','
                app_ca+=machines[m]+':'+str(lp)

        elif s.startswith('web'):
                if j%2==0:
                        web_ca+=','
                web_ca+=machines[m]+':'+str(lp)

        printline("Managed server :"+s+" created")

printline("configured managed servers done.")
printline("app cluster address:"+app_ca)
printline("Web cluster address:"+web_ca)

# Create and Configure a Cluster and assian the Managed Servers to that cluster
clusters={'app_clustr1':'app01,app02', 'web_clustr1':'web01,web02'}
clstrs=clusters.keys()
for c in clstrs:
        cd('/')
        create(c,'Cluster')
        assign('Server', clusters[c],'Cluster', c)
        cd('Clusters/'+c)
        set('ClusterMessagingMode','multicast')
        if c.startswith('app'):
                set('ClusterAddress',app_ca)
        elif c.startswith('web'):
                set('ClusterAddress',web_ca)
        set('MulticastAddress','237.0.0.101')
        set('MulticastPort',7200+clstrs.index(c))
        printline("cluster "+c+" created")

printline("Configured clusters and assigned managed servers done.")
#Write the domain and Close the domain template

updateDomain()
closeDomain()

printline("Task completed successfully, exiting!!!")
exit()

Now the properties file which you can enhance with your limitations
WLSAdminIP=192.168.33.100
AdminPort=8001
AdminPasswd=welcome1
DomainPath=/u01/app/oracle/domains
DomainName=uat_domain


Lets have the execution screen for you:





Please write your valuable feedback on this post, so that we can keep improve further to have more interesting fun stuff soon for you.

Wednesday, January 27, 2010

WLST Offline vs WLST Online

Hey Middleware automation expert, Welcome to my Post. Working with WLST we have two different sections of commands available they are defined as: 1. Off-line WLST (default shell)
2. Online WLST mode (after connecting admin)

 

WLST Offline
The WLST offline configuration commands analogous to the Configuration Wizard. You just need to know the navigation on the WebLogic configuration MBean trees, modify the MBean attribute values. Internally this WLST offline commands works on WebLogic domain Configuration Framework, the Configuration Wizard also uses it.
Consistent results when using either tool read and write access to the configuration data that is persisted in the domain’s config directory or in a domain template JAR

These WLST offline commands intended to create a domain or modify a non-running domain. Used during WLS install to create samples domains

WLST Online
The WLST online commands are analogous to the Administration Console changes after connecting to admin server. WLST Online mode is a Java Management Extension (JMX) client it allow you to interact with in-memory runtime Management Beans (MBeans). In the online administrator intended use the runtime management tools: configuration,
management, deployment, monitoring.
When you use connect() command at offline it will transfer your prompt to ServerConfig that indicates online command mode. Where the commands will execute directly on running/ active resources.
The following table shows the major differences between
Offline, Online commands:

WLST Offline vs WLST Online


WLST Offline


WLST Online


1.WLST Offline commands can do:

a) Create/modify domain templates

b) Create domains

c) Extend an existing domains by access and modify the configuration for
an offline domain



2. WLST Offline mode commands can’t do:

a) View runtime performance data

b) Modify security data


1. WLST Online commands can do:

a) Change configuration when servers are in RUNNING state

b) View runtime data for monitoring various runtime MBeans performances

c) Deploy applications targeting to Servers or clusters

d) Start and stop servers or cluster members.



2. WLST Online commands can’t do the following:

a) Create a new domain (must be offline mode) you can only update an
existing domain configuration.


3. Default interactive mode will be in offline mode


3. The offline connect() command changes to online, disconnect() command
used to come back to offline. Mostly script mode is useful.


4. Configuring resources like JDBC, JMS can be assigned with assign()
command to targets.


4. Configuring resources required set command with Targets as argument and
committing the changes with save(), activate() commands.


5. The Offline commands are executed faster

5. Online commands are slower because they have to interact with live objects.

Earlier this table was big aquard to look now it reshaped with proper wraper, that overcome blogger table blanks issue.


Hope this table helped you!! Keep writing your feedback comments!!

Popular Posts