Wednesday, 11 January 2012

WebLogic 11g: Setup Node Manage


Overview


* See this post for a Node Manager overview.

* See this post on how to install WebLogic and SOA Suite.

Setup Machine

Create a Machine if None Exists

* Start Admin Server with startup script.
* Login Admin Console.
* Create a new Machine type if one does not exist.
- Go to: soa_domain > Environment > Machines

Assign Machine to Managed Server

* Assign managed servers to be managed by NM to newly created machine.
- Click soa_domain > Environment > Servers > Configuration tab.
- Click on the managed server to be added to new machine.
- Assign Machine property.

Assign Machine to Admin Server

* Stop Admin Server with script.
* Go to domain config directory.
cd /opt/oracle/Middleware/home_11gr1/user_projects/domains/soa_domain/config
* Backup config.xml
cp config.xml config.xml.082211
* Assign AdminServer to machine by adding <machine>LocalMachine</machine> immediately beblow the AdminServer name element:
 
  <server>
    <name>AdminServer</name>
    <machine>LocalMachine</machine>
  ...
 
* Start AdminServer with script.
* Check that AdminServer has been successfully assigned to machine.

Set Server Specific Startup Parameters

* If you have set StartScriptEnabled to true in nodemanager.properties (see below), then the class path and JVM arguments from the script will be used first and the values you specified on the Server Startup page second.
* You can override server specific startup parameters on the Environment > Servers > my_server > Configuration > Server Start page.

* Note: use -Xnohup instead of -Xrs if you use JRockit JVM.

Setup NM

Modify nodemanager.properties

* Go to /opt/oracle/Middleware/home_11gr1/wlserver_10.3/common/nodemanager directory.
 
cd /opt/oracle/Middleware/home_11gr1/wlserver_10.3/common/nodemanager
 
* Edit nodemanager.properties and set the following properties to true:
CrashRecoveryEnabled=true
StartScriptEnabled=true
StopScriptEnabled=true

Start NM

 
# start NM
cd /opt/oracle/Middleware/home_11gr1/wlserver_10.3/server/bin
./startNodeManager.sh
 

Invoke WLST and Connect to NM

 
# Start WLST
cd /opt/oracle/Middleware/home_11gr1/wlserver_10.3/common/bin
./wlst.sh
 
# Connect to NM
nmConnect('weblogic', 'welcome1', 'localhost', '5556', 'soa_domain', '/opt/oracle/Middleware/home_11gr1/user_projects/domains/soa_domain','ssl')
 

Enroll Domain into Node Manager

 
# Connect to Admin Server:
connect('weblogic','welcome1','t3://localhost:7001')
 
# Enroll domain:
nmEnroll('/opt/oracle/Middleware/home_11gr1/user_projects/domains/soa_domain', '/opt/oracle/Middleware/home_11gr1/wlserver_10.3/common/nodemanager')
 

Setup Startup Script

Set Debug Flag to False

* In dev mode, the debug flag defaults to true in the startup script. It will cause error 202: bind failed: Address already in use error when you try to start managed servers.
 
cd /opt/oracle/Middleware/home_11gr1/user_projects/domains/soa_domain/bin
vi setDomainEnv.sh
 
#debugFlag="true"
debugFlag="false"
export debugFlag
 

Start Servers via NM

Start Admin Server via NM

* Stop Admin Server with script.
* Start Admin Server with NM:
 
# Connect to NM
nmConnect('weblogic', 'welcome1', 'localhost', '5556', 'soa_domain', '/opt/oracle/Middleware/home_11gr1/user_projects/domains/soa_domain','ssl')
 
# Start AdminServer
nmStart('AdminServer')
 
# Show Admin Server status
nmServerStatus('AdminServer')
 

Start Managed Server via NM

 
# Connect to Admin Server
connect('weblogic','welcome1','t3://localhost:7001')
 
# Start Managed Server
start('soa_server1')
 
nmServerStatus('soa_server1')
 

Test Crash Recovery

* Find pid for managed server.
 
cd /opt/oracle/Middleware/home_11gr1/user_projects/domains/soa_domain/servers/soa_server1/data/nodemanager
cat cat soa_server1.pid
 
# We got
21786
 
# Check process and we got one process
ps -ef|grep 21786
 
* Kill process manually.
 
# Kill process
kill -9 21786
 
# Recheck process and it should be gone
 
* Check auto start.
 
# Check soa_server1.pid and we got a new process id
24600
 
* Login Admin Console and you should see soa_server1 is in the state of STARTING or RUNNING.

Issues

error 202: bind failed: Address already in use

* This happened when I tried to start managed server from NM.
* It's due to servers were started in debug mode and the debug port is already in use by Admin Server when it got started.
* See this post for more discussions.
* Fix: set debugFlag to false in setDomainEnv.sh file.
 
cd /opt/oracle/Middleware/home_11gr1/user_projects/domains/soa_domain/bin
vi setDomainEnv.sh
 
#debugFlag="true"
debugFlag="false"
export debugFlag
 

No comments:

Post a Comment