![]() ![]() ![]() ![]() ![]() ![]() |
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 in Managing Server Startup and Shutdown.
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.
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.
You can use WLST to do the following with Node Manager:
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 Server 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 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.
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 domain’s Administration Server does not need to be running for WLST and Node Manager to start a server instance using this technique.
To connect WLST to a Node Manager and start servers:
See General Node Manager Configuration in the Node Manager Administrator’s Guide.
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.
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.
nmConnect
command.
wls:/offline>
nmConnect('username','password','nmHost','nmPort','domainName','domainDir','nmType')
nmConnect('weblogic', 'weblogic', 'localhost', '5556', 'mydomain','c:/bea/user_projects/domains/mydomain','ssl')
Connecting to Node Manager ...
>
Successfully connected.
wls:/nm/mydomain
For detailed information about nmConnect
command arguments, see nmConnect.
nmStart
command to start a server.
wls:/nm/mydomain>
nmStart('AdminServer')
starting server AdminServer
>
...
Server AdminServer started successfully
wls:/nm/mydomain
nmServerStatus
command.
wls:/nm/mydomain
>nmServerStatus('serverName')
RUNNING
>
wls:/nm/mydomain
nmKill
command.For more information about WLST Node Manager commands, see Node Manager Commands.
To start Managed Servers and clusters using Node Manager:
See General Node Manager Configuration in the Node Manager Administrator’s Guide.
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.
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.
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.
For detailed information about connect
command arguments, see connect.
start('
managedServerName
','Server')
where managedServerName
is the name of the server. For example,start('managed1','Server')
start('
clusterName
', 'Cluster')
where clusterName
is the name of the cluster. For example:start('mycluster', 'Cluster')
For more information, see start.
The following sections describe starting and managing server state without using the 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.
To start an Administration Server without using Node Manager:
For more information, see Creating Domains Using WLST Offline.
By default, this directory is BEA_HOME
\user_projects\domains\
domain_name
, where BEA_HOME
is the top-level installation directory of Oracle WebLogic products.
java weblogic.WLST
startServer
command to start the Administration Server.
startServer([
adminServerName
], [
domainName
], [
url
], [
username
], [
password
],[
domainDir
], [
block
], [
timeout
], [
serverLog
], [
systemProperties
], [
jvmArgs
] [
spaceAsJvmArgsDelimiter
])
For detailed information about startServer
command arguments, see startServer.
wls:offline/>
startServer('AdminServer','mydomain','t3://localhost:7001','weblogic','weblogic','c:/bea/user_projects/domains/mydomain','true','60000','false')
After WLST starts a server instance, the server runs in a separate process from WLST; exiting WLST does not shut down the server.
WLST life cycle commands enable you to control the states through which a server instance transitions. See Life Cycle Commands. Oracle recommends that you enable and use the domain’s administration port when you connect to servers and issue administrative commands. See Securing the WLST Connection.
The commands in Listing 4-1 explicitly move WebLogic Server through the following server states: RUNNING->ADMIN->RUNNING->SHUTDOWN
.
Start WebLogic Server before running this script. See Invoking WLST.
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")
![]() ![]() ![]() |