WebLogic NodeManager Quick Start
By james.bayer on Jan 08, 2010
*Update 1/10/2010* I realized after my post that I forgot a few things. 1) You should always have a catchy image at the top of a blog post to add some visual context to your post (see TechCrunch for a blog that almost always follows this). So I’ve added a NodeManager architecture diagram. 2) My colleague Phil Aston (co-author of the book I recommend below) pointed out a much simpler way of configuring the classpath to use StartScriptEnabled=true in nodemanager.properties which I refer to below.
One of my customers is new to WebLogic and asked if I could instruct them how to automatically start their WebLogic Server instances when the OS is booted. Node Manager can be used for that and more. I put together a quick start guide that might help you get started quickly if you’re new to Node Manager like I was earlier today. I’ve translated most of that documentation into a quick blog post. I’ve definitely cut some corners (using demo certs, default path to the domain dir and node manager dir, etc). If you want to get a feel for Node Manager quickly taking those grains of salt, read-on. There is no included service for *nix systems, you’ll have to create an xinetd service one yourself and there are examples of that in the documentation and in the book referenced below.
This is a short guide to getting started with WebLogic Server Node Manager, the process agent used to start and stop WebLogic Server instances. This is not a substitute for the complete documentation, but merely intended to get up and running quickly. Upon completiion of these steps, WebLogic Server processes should be automatically managed by Node Manager. When an OS instance is rebooted, WebLogic Server should return to the state it was in prior to the reboot (either started or stopped).
Professional Oracle WebLogic Server book with real-world advice and best practices for Node Manager starting on page 560:
The book is highly recommended as I mentioned I cut some corners here for simplicity.
The assumption is that the WebLogic Server installation has been done and that the Node Manager Windows Service was installed as a part of the installation.
Any paths reflected below should be updated to reflect your directory structures. In fact, it probably would not be a bad idea to find/replace some of the following with the relevant strings:
- WebLogic Server installation path: D:\Oracle\wls11g
- Hostname: jbayer-us
- Domain path: D:\Oracle\wls11g\user_projects\domains\my_domain
This needs to be done if you installed Node Manager with the standard installer because by default Node Manager binds to localhost. So as more OS instances are added, it will be required to have Node Manager instances on the network communicate to each other. This can only happen if Node Manager binds to an network interface that is available remotely.
- open cmd prompt
- run D:\Oracle\wls11g\wlserver_10.3\server\bin\setWLSEnv.cmd
- run D:\Oracle\wls11g\wlserver_10.3\server\bin\uninstallNodeMgrSvc.cmd
- Make backup copy of installNodeMgrSvc.cmd
- edit installNodeMgrSvc.cmd to bind to hostname for remote starts
- set NODEMGR_HOST=jbayer-us
- run D:\Oracle\wls11g\wlserver_10.3\server\bin\installNodeMgrSvc.cmd
- start the service – mine is called “Oracle WebLogic NodeManager…” but on older versions it’s likely will start with “BEA …”
- starting the NodeManager process should create the nodemanager.properties file we will edit next
CrashRecovery and StartupScriptEnabled (updated 01/10/2010)
- We want to Enable NodeManager to restore servers to their last known state after a reboot.
- Open nodemanager.properties from the directory D:\Oracle\wls11g\wlserver_10.3\common\nodemanager\
- Change the CrashRecoveryEnabled property from false to true:
- Also, because the domain’s \bin\startWebLogic script already has classpath configured, which is especially helpful for use with SmartUpdate that manages WebLogic patches as those classpath’s are not trivial to understand, I strongly recommend setting
StartupScriptEnabled=trueStartScriptEnabled=true in nodemanager.properties (Thanks to Ray T for the typo fix 6/29/10)
- stop/start node manager after making changes to nodemanager.properties
- Go to the domain's AdminServer console
- If you need to start it, run <your_domain_dir>\bin\startWebLogic.cmd
- With the console navigate to <domain_name> -> Environment -> Machines
- Create a new machine – I named mine after the hostname of the server - jbayer-us
- If you have more than one OS instance, create one machine for each.
- In console go to <domain_name> -> Environment -> Servers
- Create a new server, example: managedServer1
- Put in the listen address to the hostname you want to bind to, in my case jbayer-us
- Change the port to 8001or another available port so as not to conflict with the 7001 port of the AdminServer
- Assign managedServer1 it to the jbayer-us machine you just created - <domain_name> -> Enviornment -> Servers -> managedServer1
- There should be a dropdown you can use to select the machine
- Click the save button on this settings page (don't forget this step)
- Now activate changes if required
We need to assign the machine for the AdminServer, this cannot be done while the AdminServer is running.
- Stop AdminServer
- Open the domain config, example - D:\Oracle\wls11g\user_projects\domains\my_domain\config\config.xml
- Find the element used to assign the machine for managedServer1
- Copy that and paste that element right after the AdminServer <name/> element
- If it is not already set, also specify the AdminServer listen address to be the hostname to bind to, by default it is blank which means bind to all network interfaces.
- After these changes my config.xml snippet for the AdminServer looks like this:
- Start the AdminServer again with the domain directory’s bin\startWebLogic.cmd
- Check the console page <domain_name> -> Environment -> Servers to see that the servers are defined correctly as expected
- Navigate with a command prompt go to the domain directory
- run bin\setDomainEnv.cmd
- run java weblogic.WLST
- connect to the AdminServer with your credentials:
- Make sure you use forward slashes instead of backslashes in Windows:
- Now go back to the web console - http://localhost:7001, for each server in the environment, go to the server start tab and put in the appropriate values.
- If you are using StartScriptEnabled=true in nodemanager.properties, then the classpath and jvm arguments from the script will be used first and the values you specify on the Server Startup tab will get added to the end, so you only need to enter values that are unique to each server in the classpath and arguments section.
- If you’re using Sun JDK instead of JRockit, then use –Xrs instead of –Xnohup refer to the official docs for more on this, but it has to do with handling OS signals properly.
- 7-2-10 update: Reader Ray T writes in with another tip:
“After some testing: starting, stopping servers, killing processes, rebooting etc after the configuration, I also found that I could not get the managed servers to shutdown cleanly - or at least the console would not recognize that they had. This had the added side effect of then not letting me start/restart a managed server via the console.
I found that also adding StopScriptEnabled=true solved that final problem.”
Click the image to enlarge – actual text values below:
Classpath is empty as the script values are sufficient
Security Policy File
- Now do the same thing for each managed server.
- Activate the changes if required
- Set the Node Manager username/password for the domain in the console
- Click <domain_name> in the console navigator
- Select Security tab
- Expand to the "Advanced" options about half-way down the page
- Choose a Node Manager username/password and put it in the username/password/confirm boxes your credentials, these could be unique from your user used to start the AdminServer, but I chose to keep mine the same weblogic/welcome1. If you change this user name and password, then you’ll need to specify both when using the command nmConnect(). Thanks Ray T for the catch - 6/29/10.
- In console, go to each server's Logging -> General page
- Expand to the Advanced section half-way down the page
- Change the standard out notice level to "Critical"
- This log file that captures Standard Out does not roll over while a server is running, so it's really important to make sure this file doesn't get too large. Note that this is not the server log file, this is only standard out.
- If it is running, shutdown the AdminServer
- Start the AdminServer with NodeManager
- Go to domain dir
- run bin\setDomainEnv.cmd
- run java weblogic.WLST
nmConnect(domainName='my_domain')nmConnect(domainName=’my_domain’, username=’weblogic’, password=’welcome1’) 6/29/10 Updated thanks to Ray T who noticed that if you change the domain’s Node Manager user and password in the section above called “Node Manager Username and Password” that you’ll need to specify those values here otherwise the defaults of weblogic/welcome1 are used, which worked in my case, but not for others.
- Go to console -> Environment -> Servers control tab and start the managed server from the console. It will send a command to Node Manager which actually performs the operation on the console's behalf.
- Gotcha! – If you have never started the managed server ever before and you try to start it from Node Manager, you might get an error. In the server log it mjght say something like: Booting as admin server, but servername, managedServer1, does not match the admin server name, AdminServer To get around this, simply start the Managed Server for the first time using either the Admin Console Servers->Control tab or the startManagedWebLogic.cmd script. Subsequent nmStart commands should not have this issue any longer.
Test Killing and Restarting
If the servers are started successfully by Node Manager, try and kill a process from task manager and see if it restarts.
Looking at the Node Manager directory in the domain for each Managed Server, you will be able to see the state - below is a screenshot of managedServer1's files. The PID and .state files should tell you what you need to know to see if the server recovered. If it did not, the .out file in the server log directory should hopefully give you a clue why.
If manual killing of the process restarts a Server then you are ready to test an operating system reboot. Reboot the machine without stopping the WebLogic Servers. Each server should be restored to the state that it was in when the OS was rebooted.
If you have questions, post them in the WLS General OTN forum as I’m not an expert on Node Manager – just someone who wanted have a quick start guide. Cheers, James