For *nix environment NM should be configured as startup process using rc scripts. Creating rc scripts for configuring NM as a service is even simpler than configuring WebLogic Server as a service. This is mainly because NM doesn't have to be shutdown gracefully. All you have to do is write a simple shell script that starts the NM and create the symbolic link to that script from the right run level folder. The following illustrates the steps to confiure NM as service under LINUX environment. It should be very similar on other *nix environments. You need root permission to peform the following steps.
1. Create a shell script (wlsnmd) under /etc/init.d/ folder:
#! /bin/bash
case "$1" in
start)
WL_HOME = /usr/middleware/11.1.0/wlserver_10.3
$WL_HOME/server/bin/startNodeManager.sh
;;
*)
echo "Usage: $0 {start}"
exit 1
esac
exit_status
2. Assuming that we are going to start NM at run level 5, create a sysmbolic link in /etc/rc.d/rc5.d/ folder. Since it a startup script we should start the symbolic link with "S" and followed by a number which decide the order in which services will be called. As we are fine to start NM after all the other application/services are start let us choose 99 which is the highest number.
ln -s /etc/init.d/wlsnmd S99weblogic
If you don't want to do these manually you can also use utilities like chkconfig (included in Red Hat distributions) for managing your startup scripts. For configuring WebLogic Server as a startup process there are pre-packaged scripts (installSvc.cmd, uninstallSvc.cmd). But you have to create rc scripts similarly for WLS as well in UNIX based environments. Here is an example rc script for configuring a WebLogic Server as a startup process. But here we also need to implement the kill/stop to gracefully shutdown the server.
#! /bin/bash
case "$1" in
start|reload)
DOMAIN_HOME = /usr/middleware/domains/med_analysis
$DOMAIN_HOME/bin/startWebLogic.sh
;;
stop)
$DOMAIN_HOME/bin/stopWebLogic.sh
;;
restart|force-reload)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit_status
The node manager is one of the finest software to help anyone with the server start up process. I myself have tried it and am pretty satisfied with the outcomes.
ReplyDeleteRC-Skripts are becoming a thing of the past. Self-healing services like Solaris 10's SMF-Services are the future.
ReplyDeleteFirst we create a XML containing the scripts location and its dependencies (basically we can take the example template which comes with Solaris 10 and edit a few lines since all NM requires is a mounted filesystem, network and multiuser run-level). Lets call it weblogic_nm.xml and place it under /var/svc/manifest/application/management/ .
The we take your Shellscript (with a little extension since we need to be able to stop this service as well):
#! /bin/bash
case "$1" in
start)
WL_HOME = /usr/middleware/11.1.0/wlserver_10.3
$WL_HOME/server/bin/startNodeManager.sh
;;
stop)
$WL_HOME/server/bin/stopNodeManager.sh
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit_status
We now place this skript under
/lib/svc/method/ so it can be imported in our service database.
Now, lets import it and activate:
#svccfg import /var/svc/manifest/application/management/weblogic_nm
#svcadm enable svc:/application/management/weblogic_nm:default
And voila, we have a self-restarting Nodemanager.
Hey Bala , your blogs are pretty intresting and lotta useful, thanks alot for your info :)
ReplyDeleteHi Bala,
ReplyDeleteGood job... You are right, is very difficult to find information about how to setup NM as a service on a non-Windows environments.
What you explain above is exactly what I did in my environment, but I have 2 quick questions:
1. Weblogic scripts must be executed using the same owner used during the installation. If you call the script from the rcX.d at start up, it will be running as root, right? Is this a problem? I'm using "su - oracle -c <command>" to be sure the scripts will be running with oracle user.
2. I create 2 links within the rcX.d dir, one for the nodemanager script and other to weblogic script, exactly as you show above, but only the fist one is running at start up. Seems that the other one is not being called. Do you know if exists any dependency between them or an appropriate order to execute them?
Thanks,
Rafael
Hi Bala, this is very useful and learning lot form it.
ReplyDeleteThanks for sharing.
-Gopal
Run level five? I'd say you want all critical services to start at init 3.
ReplyDeleteRun level 5 is all about starting xorg and friends for the desktop gui environment.
#! /bin/bash
ReplyDeletecase "$1" in
start|reload)
DOMAIN_HOME=${DOMAIN_HOME:-"/home/weblogic/bea/user_projects/domains/ENTSERVER"}
$DOMAIN_HOME/bin/startWebLogic.sh >> wlup.txt
;;
stop)
DOMAIN_HOME=${DOMAIN_HOME:-"/home/weblogic/bea/user_projects/domains/ENTSERVER"}
$DOMAIN_HOME/bin/stopWebLogic.sh >> wldown.txt
;;
restart|force-reload)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
NodeManager process is started as root. It would be a problem. How can I statup NodeManager using "weblogic" account?
ReplyDeleteGreat information, I really like all your post. I will keep visiting this blog very often. It’s good to visit your website. And also please Read link bvba Woodstone which provide information monitoring software & monitoring tools
ReplyDeleteIts really a nice post, the content of this blog is really awesome and extraordinary.And also please Read link bvba Woodstone which provide information server monitoring software & server monitoring tools
ReplyDelete