Search This Blog

Sunday, September 5, 2010

NodeManager Experiments using WLST

Create Machine configure NodeManager using WLST

This blog post is renovated with latest WebLogic 12.2.1 version execution output here. We have more generic reusable functions, three different functions each one has independent task. Where the pre condition for this is you must have a domain configured and admin server is running.

  1. create a machine and setup the Nodemanager 
  2. delete machine from the domain
  3. show all machines in the domain


 

#==========================================================================
# FileName      : createMachine.py
# Updated       : 11/22/2015
# Description:
# This simple script will create multiple machines
# and also set the NodeManager properties
# use demo.properties file loadProperties command line argument expected
#
# You can add this function block to full domain
#==========================================================================

def createMachine(machineName, machineIP,nmPort=5556):
        """
        This function takes three arguments machineName, machineIP, nmPort
        The default nmPort is 5556 and nmType as Plain
        """
        cd('/')
        cmo.createUnixMachine(machineName)

        cd('/Machines/'+machineName+'/NodeManager/'+machineName)
        cmo.setNMType('Plain')
        cmo.setListenAddress(machineIP)
        cmo.setListenPort(nmPort)
        cmo.setDebugEnabled(false)

def deleteMachine(machineName):
        """
        This function takes machineName as argument
        It will delete the Machine MBean from the Domain
        """
        cd('/')
        editService.getConfigurationManager().removeReferencesToBean(getMBean('/Machines/'+machineName))
        cmo.destroyMachine(getMBean('/Machines/'+machineName))

def printMachineList():
        """
        This function will display the machines configured on a domain
        No arguments required
        """
        cd('/')
        redirect('/dev/null', toStdOut='false')
        machineslist=ls('Machines',returnMap='true')
        for m in machineslist: print m
        stopRedirect()

def main():
        """
        Here we can expect ConnectionException, WLSTException
        and also BeanAlreadyExist for createMachine function
        """
        connect(ADMINUSER,ADMINPASSWD, ADMINURL)

        print "Before machines creation..."
        printMachineList()

        edit()
        startEdit()

        for i in range(1,5):
                try:
                        createMachine('machine'+str(i), '192.168.33.'+str(100+i),5566)
                except:
                        print 'Machine creation failed...'+'machine'+str(i)
        activate()

        print "After creation..."
        printMachineList()

        HitKey=raw_input('Press any key to continue...')

        startEdit()
        for i in range(1,5):
                try:
                        deleteMachine('machine'+str(i))
                except:
                        print 'Unable to remove machine...'
        activate()

        print "After removing machines..."
        printMachineList()
main()

Excecution of the Machine configuration is as follows....


java weblogic.WLST  -loadProperties demo.properties createMachine.py

create, delete and show machines in WebLogic 12.2.1 domain

Double confirmation with Admin console

Machine in WebLogic Domain configured with WLST


Start n Stop the Server using NodeManager by WLST

Manage the Server Life Cycle continues...
[2] Configure a NodeManager to start WebLogic Server instances (using console and command-line)

Start n Stop Server using NodeManager by WLST:

In the sun Solaris environment we need to change few nodemanager.properties to run the NodeManager. There are two kinds of Node Managers available
Java based Node manager
Script based Node manager

while connecting to nodemanager we have received an error as below:

Error encounter when the java native
bash-3.00$ tail -100f nodemanager.log


weblogic.nodemanager.common.ConfigException: Native version is enabled but node manager native library could not be loaded
at weblogic.nodemanager.server.NMServerConfig.initProcessControl(NMServerConfig.java:239)
at weblogic.nodemanager.server.NMServerConfig.(NMServerConfig.java:179)
at weblogic.nodemanager.server.NMServer.init(NMServer.java:177)
at weblogic.nodemanager.server.NMServer.(NMServer.java:142)
at weblogic.nodemanager.server.NMServer.main(NMServer.java:327)
at weblogic.NodeManager.main(NodeManager.java:31)
Caused by: java.lang.UnsatisfiedLinkError: no nodemanager in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:993)
at weblogic.nodemanager.util.UnixProcessControl.(UnixProcessControl.java:16)
at weblogic.nodemanager.util.Platform.getProcessControl(Platform.java:108)
at weblogic.nodemanager.server.NMServerConfig.initProcessControl(NMServerConfig.java:237)
... 5 more

java weblogic.WLST startAdmin.py wcludomNM

connect('weblogic', 'weblogic', 't3://wlhost:7913')
nmEnroll('/home/wluser/domains/WLclsnm')
CLASSPATH to set for NodeManager:
export NM_HOME = $WL_HOME/common/nodemanager

CLASSPATH=/export/home/wladmin/wl813/bea/jdk142_04/jre/lib/rt.jar:/export/home/wladmin/wl813/bea/jdk142_04/lib/rt.jar:/export/home/wladmin/wl813/bea/patches/CR204958_810sp3_v1.jar:/export/home/wladmin/wl813/bea/weblogic81/server/lib/weblogic.jar

startNodeManager(verbose='true',NodeManagerHome='/home/wluser/bea/weblogic92/common/nodemanager')

To Check the log of nodemanager.log
tail -100f /home/wluser/bea/weblogic92/common/nodemanager/nodemanager.log

/home/wluser/bea/weblogic92/common/nodemanager/nodemanager.domains>

nmConnect('weblogic', 'weblogic', 'wlshostname','5556', 'WLclsnm', '/home/wluser/domains/WLclsnm')

prps = makePropertiesObject('weblogic.ListenPort=9013')
wls:/WLclsnm/serverConfig>
wls:/WLclsnm/serverConfig> nmStart('app01',props=prps)
Starting server app02 ...
Error Starting server app02: weblogic.nodemanager.NMException:
Exception while starting server 'app02': java.io.IOException: Server failed to start up. See server output log for more details.

prps = makePropertiesObject('weblogic.ListenPort=9013')

start('wlctr', 'Cluster')

nmStart('app02',props=prps)
Starting server AdminServer...
Server AdminServer started successfully

nmConnect('weblogic', 'weblogic', 'remotehostnameofmanagedserver' '5556','WLclsnm', '/home/wluser/domains/','plain')

Still workin progress to start the remotemanaged server by using wlst
(I am getting some errors when I tried ...will update this site Once it will done successfully if anybody is done plz post it as comment.)
Posted by Pani at 9:44 AM 1 comments:


Archana said...
Hi,
We are also facing the same issue. Not able to start managed servers using makepropertiesobject.

Did u get any solution.
Yes, Archana, We found the Solution as using PLAIN type for NodeManager is good to go.

10 comments:

  1. Hello, not sure if you are still facing issues with this, but I have been doing remote server starts for some time now and actually use a self-written tool that uses config files and nmStart so that you can change the values for arguments and then restart a server with them. I use the Java nodemanager process to do this. It gets even a little more complex when you are running in a production environment within your domain on multiple servers as well.

    Please let me know if you still have issues and I can send you a snip of code that I use to create the properties object and pass into nmStart.

    Cheers

    ReplyDelete
  2. Hey Chris, it is really interesting about Java NodeManager. I didn't tried that type yet. It will be great if you share that python script. What about pre-settings? Kindly listout if you have some time. Thanks for being with this blog posting.

    ReplyDelete
  3. Hello Pavan,

    Can you help me creating a WLST script to start node manager using xinetd service..

    ReplyDelete
  4. Jyothula,
    What is the issue you are facing ?
    Sure I might help you...

    ReplyDelete
  5. Hi, can you help on how to change the node manager type (ssl or plain) for all machines in one shot using WLST. It would be really helpful

    ReplyDelete
  6. Thats really good idea. Did you able to navigate to the corresponding MBean tree?
    Where did you reach on it? sure I will help you as per your inputs.

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. Hi, Can any one help in setting the StartScriptEnabled value to true using WLST in linux env. I am trying to automate the process of bringing up the servers and i am using a py file with WLST commands to do the same.

    Thanks,
    Gowda

    ReplyDelete
  9. Start Node Manager.
    Usually, as part of configuring Node Manager, you create a Windows service or a daemon that automatically starts Node Manager when the host computer starts.
    Node Manager is not already running, you can log on to the host computer and use WLST to start it:
    c:\>java weblogic.WLST
    wls:/offline> startNodeManager(verbose='true',StartScriptEnabled='true')

    you can provide as many as number of properites for node manager in startNodeManager as a comma sparated value
    Below are some of the propoertis you can provide thorgh startNodeManager() function
    NodeManagerHome=C:\bea\wlserver_10.3\server\bin, ListenAddress='localhost', ListenPort='5556',
    ListenBacklog='50', SecureListener='true', AuthenticationEnabled='true', NativeVersionEnabled='true', CrashRecoveryEnabled='false',
    JavaHome='C:\bea\JROCKI~1\jre', StartScriptEnabled='false', StopScriptEnabled='false',
    StartScriptName='startWebLogic.cmd', StopScriptName='', LogFile='C:\bea\wlserver_10.3\server\bin\nodemanager.log', LogLevel='INFO',
    LogLimit='0', LogCount='1', LogAppend='true', LogToStderr='true', LogFormatter='weblogic.nodemanager.server.LogFormatter',
    DomainsFile='C:\bea\wlserver_10.3\server\bin\nodemanager.domains', DomainsFileEnabled='true',
    StateCheckInterval='500', QuitEnabled='true',

    Answered by Narsimha Sastry

    ReplyDelete
  10. So working through this recently with using a properties ibject and using nodemanager to start managed servers on remote systems, I found issues with the WLST documentation.

    If you connect to an Admin server first, you can use the "start()" method there to start a server or cluster just as you would with the Admin Console.

    This does not mean you do not need the nodemanager, but it does allow you to be able to let folks control configuration via the gui console if they want, and then use this method to stop/start servers via the Admin Server instead of the Node Manager.

    ReplyDelete

Please write your comment here

Popular Posts