Starting Node Manager allows you to use the Admin Server to start and stop the WebCenter Content managed server from the browser. Starting Admin Server allows you to monitor the WebCenter Content managed server and to use.
Configuring to use Node Manager
To use Node Manager to start and stop WebCenter Content, you must first- Configure a machine
- Add the Admin Server and Managed Server to the machine
- Enable Node Manager to use the WebCenter Content startup scripts
Configure a machine
In WebLogic, a Machine is a logical representation of a physical server. The Admin Server uses the machine definition and the Node Manager to manage remote servers. During the initial configuration of WebCenter content there was the opportunity to configure machines. If you did this then you can skip this section. If not, then follow these steps to create a machine.- If not started, then start the Admin Server.
- Under Environment, select Machines.
- Select to create a new machine
- Give the machine a meaningful name and set the OS then select Next
- Complete the rest of the form and select Finish
Add the Admin Server and Managed Server to the machine
- Return to the home page and select Environment, Machines.
- Select the name of the machine you just created
- Select the Servers tab
- Select to add a server
- Select the server to add
- Select Next. Repeat this to add all the servers needed.
Enable Node Manager to use the WebCenter Content startup scripts
The first step is to enable Node Manager to use the startup scripts. To do this, follow these steps:- Log into your system as the user who installed WebCenter Content (oracle in my case)
- Navigate to the following directory
MIDDLEWARE_HOME/oracle_common/common/bin
MIDDLEWARE_HOME is the directory where Oracle Fusion Middleware is installed. - Run the setNMProps.sh script to set the StartScriptEnabled property to true before starting Node Manager:
./setNMProps.sh
This is a one-time action. After you run this script, you can skip this step before starting Node Manager again. - Start Node Manager with the startNodeManager script.
Linux script: WL_HOME/server/bin/startNodeManager.sh
WL_HOME is the directory where Oracle WebLogic Server is installed. - Stop the Node Manager and the Admin Server.
Set Node Manager to run as a startup service
The next step is to set the Node Manager to run as a service on startup. To do this, follow these steps:- Log into Linux as root
- Create a new file in /etc/init.d named nodemanager containing the following:
#!/bin/bash # nodemanager Oracle Weblogic NodeManager service # # chkconfig: 2345 85 15 # description: Oracle Weblogic NodeManager service # ### BEGIN INIT INFO # Provides: nodemanager # Required-Start: $network $local_fs $oracle-xe # Required-Stop: # Should-Start: # Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Oracle Weblogic NodeManager service. # Description: Starts and stops Oracle Weblogic NodeManager. ### END INIT INFO # Source function library. if [ -f /lib/lsb/init-functions ] then . /lib/lsb/init-functions elif [ -f /etc/init.d/functions ] then . /etc/init.d/functions fi # set Weblogic environment defining CLASSPATH and LD_LIBRARY_PATH # to start/stop various components. export MW_HOME=/u01/app/oracle/Middleware/ # # Note: # The setWLSEnv.sh not only does a good job of setting the environment, # but also advertises the fact explicitly in the console! Silence it. # . $MW_HOME/wlserver_10.3/server/bin/setWLSEnv.sh > /dev/null # set NodeManager environment export NodeManagerHome=$WL_HOME/common/nodemanager NodeManagerLockFile=$NodeManagerHome/nodemanager.log.lck # check JAVA_HOME if [ -z ${JAVA_HOME:-} ]; then export JAVA_HOME=/u01/app/oracle/jdk1.6.0_31 fi exec=$MW_HOME/wlserver_10.3/server/bin/startNodeManager.sh prog='nodemanager' user='oracle' is_nodemgr_running() { local nodemgr_cnt=`ps -ef | \ grep -i 'java ' | \ grep -i ' weblogic.NodeManager ' | \ grep -v grep | \ wc -l` echo $nodemgr_cnt } get_nodemgr_pid() { nodemgr_pid=0 if [ `is_nodemgr_running` -eq 1 ]; then nodemgr_pid=`ps -ef | \ grep -i 'java ' | \ grep -i ' weblogic.NodeManager ' | \ grep -v grep | \ tr -s ' ' | \ cut -d' ' -f2` fi echo $nodemgr_pid } check_nodemgr_status () { local retval=0 local nodemgr_cnt=`is_nodemgr_running` if [ $nodemgr_cnt -eq 0 ]; then if [ -f $NodeManagerLockFile ]; then retval=2 else retval=3 fi elif [ $nodemgr_cnt -gt 1 ]; then retval=4 else retval=0 fi echo $retval } start() { ulimit -n 65535 [ -x $exec ] || exit 5 echo -n $"Starting $prog: " su $user -c "$exec &" retval=$? echo return $retval } stop() { echo -n $"Stopping $prog: " kill -s 9 `get_nodemgr_pid` &> /dev/null retval=$? echo [ $retval -eq 0 ] && rm -f $NodeManagerLockFile return $retval } restart() { stop sleep 10 start } reload() { restart } force_reload() { restart } rh_status() { local retval=`check_nodemgr_status` if [ $retval -eq 0 ]; then echo "$prog (pid:`get_nodemgr_pid`) is running..." elif [ $retval -eq 4 ]; then echo "Multiple instances of $prog are running..." else echo "$prog is stopped" fi return $retval } rh_status_q() { rh_status >/dev/null 2>&1 } case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart) $1 ;; reload) rh_status_q || exit 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 restart ;; *) echo -n "Usage: $0 {" echo -n "start|" echo -n "stop|" echo -n "status|" echo -n "restart|" echo -n "condrestart|" echo -n "try-restart|" echo -n "reload|" echo -n "force-reload" echo "}" exit 2 esac exit $?
- Edit the nodemanager file and verify the following
- # chkconfig: 2345 85 15
this line tells chkconfig to set the run levels at 2345 (same as Oracle database) it also puts the start at priority 85 and the stop at priority 15 (database is 80 and 05) - export MW_HOME=/u01/app/oracle/Middleware/
- export JAVA_HOME=/u01/app/oracle/jdk1.6.0_31
- user='oracle'
- save and exit
- # chkconfig: 2345 85 15
- make it executable
[root@dev init.d]# chgmod 755 nodemanager [root@dev init.d]#
- add it to the services list
[root@dev init.d]# chkconfig --add nodemanager [root@dev init.d]#
- check that it is there with
[root@dev init.d]# chkconfig --list|grep nodemanager nodemanager 0:off 1:off 2:off 3:on 4:on 5:on 6:off [root@dev init.d]#
- Test the service
[root@dev init.d]# [root@dev init.d]# [root@dev init.d]# service nodemanager start Starting nodemanager: : : INFO: Plain socket listener started on port 5556 [root@dev init.d]# [root@dev init.d]# service nodemanager status nodemanager (pid:21241) is running... [root@dev init.d]#
Set domain servers to run as a startup service
Now that Node Manager starts automatically, we need to get the Admin Server and Managed Servers running.- Log into Linux as root
- Create a directory called nm_scripts in the Middleware home and place these files there
- dev_env.sh
export wlsAdminServer="AdminServer" export nmUserID="weblogic" export wlsUserID="weblogic" export wlsPassword="welcome1" #export wlsHost=`hostname` export wlsHost="localhost" export nmPort="5556" export asPort="7001" export wlsAdminURL="t3://${wlsHost}:${asPort}" export wlsDomainName="dev_domain" export wlsMiddleWareHome="/u01/app/oracle/Middleware" export wlsDomainLocation="${wlsMiddleWareHome}/user_projects/domains/dev_domain" export wlsNodeManagerHome="${wlsMiddleWareHome}/wlserver_10.3/common/nodemanager"
- startServers.sh
#!/bin/sh #set the Middleware Home MW_HOME="/u01/app/oracle/Middleware" export MW_HOME #Set the WebLogic Server Home WL_HOME="${MW_HOME}/wlserver_10.3" export WL_HOME #Set the Domain Home DOMAIN_HOME="${MW_HOME}/user_projects/domains/dev_domain" export DOMAIN_HOME #Set the Scripts Home SCRIPT_HOME="${MW_HOME}/nm_scripts" export SCRIPT_HOME #Set the WLS environment varables . ${WL_HOME}/server/bin/setWLSEnv.sh >> /dev/null #Set the domain specific variables . ${MW_HOME}/nm_scripts/dev_env.sh #Change to the domain directory cd ${DOMAIN_HOME} #Execute the WLST Script java weblogic.WLST ${SCRIPT_HOME}/StartServers.py
- StartServers.py
import os if os.environ.has_key('wlsAdminServer'): wlsAdminServer = os.environ['wlsAdminServer'] if os.environ.has_key('nmUserID'): nmUserID = os.environ['nmUserID'] if os.environ.has_key('wlsUserID'): wlsUserID = os.environ['wlsUserID'] if os.environ.has_key('wlsPassword'): wlsPassword = os.environ['wlsPassword'] if os.environ.has_key('wlsAdminURL'): wlsAdminURL = os.environ['wlsAdminURL'] if os.environ.has_key('wlsNodeManagerHome'): wlsNodeManagerHome = os.environ['wlsNodeManagerHome'] if os.environ.has_key('nmPort'): nmPort = os.environ['nmPort'] if os.environ.has_key('wlsHost'): wlsHost = os.environ['wlsHost'] if os.environ.has_key('wlsDomainName'): wlsDomainName = os.environ['wlsDomainName'] if os.environ.has_key('wlsDomainLocation'): wlsDomainLocation = os.environ['wlsDomainLocation'] print '-- CONNECT TO NODE MANAGER --'; try: nmConnect(nmUserID, wlsPassword, wlsHost, nmPort, wlsDomainName, wlsDomainLocation, 'plain') except: print '--NODE MANAGER IS NOT RUNNING OR NOT RESPONDING. CANNOT CONTINUE--' exit() print '-- START ADMIN SERVER --'; nmStart(wlsAdminServer) connect(wlsUserID, wlsPassword, url=wlsAdminURL, adminServerName=wlsAdminServer) domainRuntime() serverLifeCycles = cmo.getServerLifeCycleRuntimes() for serverLifeCycle in serverLifeCycles: if (serverLifeCycle.getName() == 'URM_server1'): if (serverLifeCycle.getState() != 'RUNNING'): print 'Starting Server: ' + serverLifeCycle.getName() start(serverLifeCycle.getName(), 'Server') print ' -- DISCONNECT FROM ADMIN SERVER --' disconnect() print '--DISCONNECT FROM NODE MANAGER --' nmDisconnect() exit()
- statusServers.sh
#!/bin/sh #set the Middleware Home MW_HOME="/u01/app/oracle/Middleware" export MW_HOME #Set the WebLogic Server Home WL_HOME="${MW_HOME}/wlserver_10.3" export WL_HOME #Set the Domain Home DOMAIN_HOME="${MW_HOME}/user_projects/domains/dev_domain" export DOMAIN_HOME #Set the Scripts Home SCRIPT_HOME="${MW_HOME}/nm_scripts" export SCRIPT_HOME #Set the WLS environment varables . ${WL_HOME}/server/bin/setWLSEnv.sh >> /dev/null #Set the domain specific variables . ${MW_HOME}/nm_scripts/dev_env.sh #Change to the domain directory cd ${DOMAIN_HOME} #Execute the WLST Script java weblogic.WLST ${SCRIPT_HOME}/StatusServers.py
- StatusServers.py
import os if os.environ.has_key('wlsAdminServer'): wlsAdminServer = os.environ['wlsAdminServer'] if os.environ.has_key('nmUserID'): nmUserID = os.environ['nmUserID'] if os.environ.has_key('wlsUserID'): wlsUserID = os.environ['wlsUserID'] if os.environ.has_key('wlsPassword'): wlsPassword = os.environ['wlsPassword'] if os.environ.has_key('wlsAdminURL'): wlsAdminURL = os.environ['wlsAdminURL'] if os.environ.has_key('wlsNodeManagerHome'): wlsNodeManagerHome = os.environ['wlsNodeManagerHome'] if os.environ.has_key('nmPort'): nmPort = os.environ['nmPort'] if os.environ.has_key('wlsHost'): wlsHost = os.environ['wlsHost'] if os.environ.has_key('wlsDomainName'): wlsDomainName = os.environ['wlsDomainName'] if os.environ.has_key('wlsDomainLocation'): wlsDomainLocation = os.environ['wlsDomainLocation'] try: nmConnect(nmUserID, wlsPassword, wlsHost, nmPort, wlsDomainName, wlsDomainLocation, 'plain') except: print '--NODE MANAGER IS NOT RUNNING OR NOT RESPONDING. CANNOT CONTINUE--' exit() adminStatus = nmServerStatus(wlsAdminServer) if (adminStatus == 'RUNNING'): connect(wlsUserID, wlsPassword, url=wlsAdminURL, adminServerName=wlsAdminServer) else: print '--CANNOT CONTINUE. ADMIN SERVER IS NOT RUNNING--' print '--DISCONNECT FROM NODE MANAGER --' nmDisconnect() exit() domainRuntime() serverLifeCycles = cmo.getServerLifeCycleRuntimes(); for serverLifeCycle in serverLifeCycles: print 'Server: ' + serverLifeCycle.getName() + ', State: ' + serverLifeCycle.getState(); if (serverLifeCycle.getState() == 'RUNNING'): cd('ServerRuntimes/' + serverLifeCycle.getName()); jvm = cmo.getJVMRuntime(); print 'Java VM Vendor: ' + jvm.getJavaVMVendor(); print 'Heap Free Space: ' + repr(jvm.getHeapFreePercent()) + '%'; print 'Heap Size Current: ' + repr(jvm.getHeapSizeCurrent()); print 'Maximum Heap Size: ' + repr(jvm.getHeapSizeMax()); cd('/'); print ' -- DISCONNECT FROM ADMIN SERVER --' disconnect() print '--DISCONNECT FROM NODE MANAGER --' nmDisconnect() exit()
- stopServers.sh
#!/bin/sh #set the Middleware Home MW_HOME="/u01/app/oracle/Middleware" export MW_HOME #Set the WebLogic Server Home WL_HOME="${MW_HOME}/wlserver_10.3" export WL_HOME #Set the Domain Home DOMAIN_HOME="${MW_HOME}/user_projects/domains/dev_domain" export DOMAIN_HOME #Set the Scripts Home SCRIPT_HOME="${MW_HOME}/nm_scripts" export SCRIPT_HOME #Set the WLS environment varables . ${WL_HOME}/server/bin/setWLSEnv.sh >> /dev/null #Set the domain specific variables . ${MW_HOME}/nm_scripts/dev_env.sh #Change to the domain directory cd ${DOMAIN_HOME} #Execute the WLST Script java weblogic.WLST ${SCRIPT_HOME}/StopServers.py
- StopServers.py
import os if os.environ.has_key('wlsAdminServer'): wlsAdminServer = os.environ['wlsAdminServer'] if os.environ.has_key('nmUserID'): nmUserID = os.environ['nmUserID'] if os.environ.has_key('wlsUserID'): wlsUserID = os.environ['wlsUserID'] if os.environ.has_key('wlsPassword'): wlsPassword = os.environ['wlsPassword'] if os.environ.has_key('wlsAdminURL'): wlsAdminURL = os.environ['wlsAdminURL'] if os.environ.has_key('wlsNodeManagerHome'): wlsNodeManagerHome = os.environ['wlsNodeManagerHome'] if os.environ.has_key('nmPort'): nmPort = os.environ['nmPort'] if os.environ.has_key('wlsHost'): wlsHost = os.environ['wlsHost'] if os.environ.has_key('wlsDomainName'): wlsDomainName = os.environ['wlsDomainName'] if os.environ.has_key('wlsDomainLocation'): wlsDomainLocation = os.environ['wlsDomainLocation'] print '-- CONNECT TO NODE MANAGER AND ADMINSERVER --'; try: nmConnect(nmUserID, wlsPassword, wlsHost, nmPort, wlsDomainName, wlsDomainLocation, 'plain') except: print '--NODE MANAGER IS NOT RUNNING OR NOT RESPONDING. CANNOT CONTINUE--' exit() adminStatus = nmServerStatus(wlsAdminServer) if (adminStatus == 'RUNNING'): connect(wlsUserID, wlsPassword, url=wlsAdminURL, adminServerName=wlsAdminServer) else: print '--CANNOT CONTINUE. ADMIN SERVER IS NOT RUNNING--' print '--DISCONNECT FROM NODE MANAGER --' nmDisconnect() exit() domainRuntime() serverLifeCycles = cmo.getServerLifeCycleRuntimes() for serverLifeCycle in serverLifeCycles: if (serverLifeCycle.getState() == 'RUNNING') and (serverLifeCycle.getName() != wlsAdminServer ): print 'Stopping Server: ' + serverLifeCycle.getName() nmKill(serverLifeCycle.getName()) print ' -- DISCONNECT FROM ADMIN SERVER --' disconnect() print '-- STOP ADMIN SERVER --'; nmKill('AdminServer') print '--DISCONNECT FROM NODE MANAGER --' nmDisconnect() exit()
- dev_env.sh
- Create a new file in /etc/init.d named wlsservers containing the following:
#!/bin/bash # wlsservers Oracle Weblogic admin and managed servers # # chkconfig: 2345 86 14 # description: Oracle Weblogic admin and managed servers # ### BEGIN INIT INFO # Provides: wlsservers # Required-Start: $network $local_fs $oracle-xe # Required-Stop: # Should-Start: # Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Oracle Weblogic admin and managed servers. # Description: Starts and stops Oracle Weblogic admin and managed servers. ### END INIT INFO # Source function library. if [ -f /lib/lsb/init-functions ] then . /lib/lsb/init-functions elif [ -f /etc/init.d/functions ] then . /etc/init.d/functions fi #set the Middleware Home MW_HOME="/u01/app/oracle/Middleware" export MW_HOME #Set the WebLogic Server Home WL_HOME="${MW_HOME}/wlserver_10.3" export WL_HOME #Set the Domain Home DOMAIN_HOME="${MW_HOME}/user_projects/domains/lowes_domain" export DOMAIN_HOME #Set the Scripts Home SCRIPT_HOME="${MW_HOME}/nm_scripts" export SCRIPT_HOME #Set the WLS environment varables . ${WL_HOME}/server/bin/setWLSEnv.sh >> /dev/null #Set the domain specific variables . ${MW_HOME}/nm_scripts/lowes_env.sh #Change to the domain directory cd ${DOMAIN_HOME} execStart='java weblogic.WLST ${SCRIPT_HOME}/StartServers.py' execStop='java weblogic.WLST ${SCRIPT_HOME}/StopServers.py' execStatus='java weblogic.WLST ${SCRIPT_HOME}/StatusServers.py' prog='wlsservers' user='oracle' start() { echo -n $"Starting $prog: " su $user -c "$execStart &" retval=$? echo return $retval } stop() { echo -n $"Stopping $prog: " su $user -c "$execStop &" retval=$? echo return $retval } status() { echo -n $"Status $prog: " su $user -c "$execStatus &" retval=$? echo return $retval } restart() { echo -n $"Stopping $prog: " su $user -c "$execStop &" retval=$? echo $retval echo echo -n $"Starting $prog: " su $user -c "$execStart &" retval=$? echo return $retval } case "$1" in start) $1 ;; stop) $1 ;; restart) $1 ;; status) $1 ;; *) echo -n "Usage: $0 {" echo -n "start|" echo -n "stop|" echo -n "status|" echo -n "restart|" echo "}" exit 2 esac exit $?
- Verify the data and settings in these files
- Edit the wlsservers file and verify the following
# chkconfig: 2345 86 14 this line tells chkconfig to set the run levels at 2345 (same as Oracle database) it also puts the start at priority 85 and the stop at priority 15 (database is 80 and 05) MW_HOME="/u01/app/oracle/Middleware" WL_HOME="${MW_HOME}/wlserver_10.3" DOMAIN_HOME="${MW_HOME}/user_projects/domains/lowes_domain" SCRIPT_HOME="${MW_HOME}/nm_scripts" export SCRIPT_HOME user='oracle'
- save and exit
- Edit the wlsservers file and verify the following
- make it executable
[root@dev init.d]# chgmod 755 wlsservers [root@dev init.d]#
- Add it to the services list
[root@dev init.d]# chkconfig --add wlsservers [root@dev init.d]#
- Check that it is there with
[root@dev init.d]# chkconfig --list|grep wlsservers wlsservers 0:off 1:off 2:off 3:on 4:on 5:on 6:off [root@dev init.d]#
- Test the service
[root@dev init.d]# service wlsservers start [root@dev init.d]# [root@dev init.d]# service wlsservers status [root@dev init.d]# [root@dev init.d]# service nodemanager stop [root@dev init.d]#