4 Managing the Server Life Cycle

During its lifetime, a server can transition through a number of operational states, such as shutdown, starting, standby, admin, resuming, and running. For more information about the server life cycle, see "Understanding Server Life Cycle" inManaging Server Startup and Shutdown for Oracle WebLogic Server.

The following sections describe how to use WebLogic Scripting Tool (WLST) to manage and monitor the server life cycle:

For information on other techniques for starting and stopping server instances, see "Starting and Stopping Servers" in Managing Server Startup and Shutdown for Oracle WebLogic Server.

Using WLST and Node Manager to Manage Servers

Node Manager is a utility that enables you to control the life cycles of multiple servers through a single WLST session and a single network connection. (It can also automatically restart servers after a failure.) For more information about Node Manager, see the Node Manager Administrator's Guide for Oracle WebLogic Server.

You can use WLST to do the following with Node Manager:

Start a Node Manager.

Connect to a Node Manager, then use the Node Manager to start and stop servers on the Node Manager machine. See Figure 4-1.

A Node Manager process is not associated with a specific WebLogic domain but with a machine. You can use the same Node Manager process to control server instances in any WebLogic domain, as long as the server instances reside on the same machine as the Node Manager process.

For information about the commands that WLST can use while acting as a Node Manager client, see "Node Manager Commands" in WebLogic Scripting Tool Command Reference.

Connect to an Administration Server, then use the Administration Server to start and stop servers in the domain. See Figure 4-2.

In this case, WLST is a client of the Administration Server, and the Administration Server uses one or more Node Managers to start Managed Servers.

For information about the life cycle commands that WLST can use while acting as an Administration Server client, see "Life Cycle Commands" in WebLogic Scripting Tool Command Reference.

Using Node Manager to Start Servers on a Machine

WLST can connect to a Node Manager that is running on any machine and start one or more WebLogic Server instances on the machine. A WebLogic domain's Administration Server does not need to be running for WLST and Node Manager to start a server instance using this technique.

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. See "Running Node Manager as a Service" in the Node Manager Administrator's Guide for Oracle WebLogic Server.

If 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()

For more information about startNodeManager, see "startNodeManager" in WebLogic Scripting Tool Command Reference.

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. See "Running Node Manager as a Service" in the Node Manager Administrator's Guide for Oracle WebLogic Server

If 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()

For more information about startNodeManager, see "startNodeManager" in WebLogic Scripting Tool Command Reference.

Start an Administration Server.

If WLST is not already running, invoke it. Then connect WLST to a running WebLogic Administration Server instance using the connect command.

c:\>java weblogic.WLST
wls:/(offline)> connect('username','password')
Connecting to weblogic server instance running at t3://localhost:7001 as
username weblogic ...
Successfully connected to Admin Server 'myserver' that belongs to domain
'mydomain'.
Warning: An insecure protocol was used to connect to the server.
To ensure on-the-wire security, the SSL port or Admin port should be used
instead.
wls:/mydomain/serverConfig>

Starting and Managing Servers Without Node Manager

If you do not use Node Manager, WLST cannot start Managed Servers. For information on other techniques for starting and stopping server instances, see "Starting and Stopping Servers" in Managing Server Startup and Shutdown for Oracle WebLogic Server.

Starting an Administration Server Without Node Manager

To start an Administration Server without using Node Manager:

If you have not already done so, use WLST to create a WebLogic domain.

After WLST starts a server instance, the server runs in a separate process from WLST; exiting WLST does not shut down the server.

Managing Server State Without Node Manager

WLST life cycle commands enable you to control the states through which a server instance transitions. See "Life Cycle Commands" in WebLogic Scripting Tool Command Reference. Oracle recommends that you enable and use the WebLogic domain's administration port when you connect to servers and issue administrative commands. See Securing the WLST Connection.

The commands in Example 4-1 explicitly move WebLogic Server through the following server states: RUNNING->ADMIN->RUNNING->SHUTDOWN.

connect("username","password","t3://localhost:8001")
# First enable the Administration Port. This is not a requirement.
# After you enable the Administration Port in a domain, WebLogic Server
# persists the setting in its configuration files. You do not need to repeat
# the process in future WLST sessions.
edit()
startEdit()
cmo.setAdministrationPortEnabled(1)
activate(block="true")
# check the state of the server
state("myserver")
# now move the server from RUNNING state to ADMIN
suspend("myserver", block="true")
# check the state
state("myserver")
# now resume the server to RUNNING state
resume("myserver",block="true")
# check the state
state("myserver")
# now take a thread dump of the server
threadDump("./dumps/threadDumpAdminServer.txt")
# finally shutdown the server
shutdown(block="true")

Scripting on this page enhances content navigation, but does not change the content in any way.