Managing Oracle Weblogic with WLST - Controlling Servers through WLST

 

Controlling Servers through WLST

WLST can be used as well to manage server life cycle and can be pretty useful, for example, if you have to start/stop a domain consisting in lots of servers. There are basically two modes to manage your servers:

  • Using the Node Manager interface
  • Without Node Manager (via the Admin Server).

Let’s shortly illustrate both approaches

Controlling servers using Node Manager

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 in order to start servers using this technique.

Start by launching WLST at first:

java weblogic.WLST

In case the Node Manager process is not already running, you can log on to the host computer and use WLST to start it:

wls:/offline> startNodeManager()

Next, connect WLST to a Node Manager by entering the nmConnect command:

nmConnect('weblogic','password123','localhost','5556','mydomain','c:/bea/user_projects/domains/mydomain','SSL')

You can now use the nmStart command to start a server:

wls:/nm/mydomain>nmStart('WLSNode1')

Monitor the status of Managed server by entering the nmServerStatus command:

wls:/nm/mydomain>nmServerStatus('WLSNode1')

Finally, you can stop the server by entering the nmKill command:

wls:/nm/mydomain>nmKill('WLSNode1')

Controlling servers without Node Manager

In the latter option, we will use the WLST startServer command to start the Administration Server. Here’s an example:

wls:offline/>startServer('AdminServer','mydomain','t3://localhost:7001','weblogic','welcome1','c:/weblogic/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. So, once you have started the administration server, you can simply connect to it and issue commands to control life cycle of servers:

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")

 

Francesco Google+