A quick tutorial for middleware products

Saturday, November 22, 2014

On November 22, 2014 by Kamlesh   No comments
WLST Server Start
The server of a WebLogic domain can be started using different techniques. The best setup depends on the technical requirements but also on the security/administration guidelines of the company. The following section introduces the different possibilities and will provide best practices information based on real project experience.
Administration Server
The administration server can be started in three different ways as explained in the subsequent sections. You can start an administration server using a start script or using WLST with or without the NodeManager. All starting mechanisms have their own advantages and disadvantages. Readers are advised to define their own strategy carefully, but keep it simple and stay with one of the discussed methods for your environments.

Using WLST and NodeManager

The NodeManager is normally used to start managed-servers. However, it can also be used to start the administration server. 


The nmConnect command can be used to connect to the NodeManager using WLST. The credentials can be given either using a user/password combination or a userconfig/keyfile combination. The following is an example that uses username/password to connect the NodeManager.

nmConnect([username, password], [host], [port], [domainName], [domainDir], [nmType])
nmConnect([userConfigFile, userKeyFile], [host], [port], [domainName], [domainDir], [nmType])

Exp:-

nmConnect('weblogic','<pw>','localhost','5556','TestDomain','/application/domains/TestDomain','SSL')
Connecting to Node Manager ...
Successfully connected to Node Manager.
wls:/nm/TestDomain>

The next script demonstrates starting the administration server using the nmStart command. This command must be provided with the name of the server, the domain directory, and properties.

nmStart([serverName], [domainDir], [props], [writer], [serverType])

Exp:-

wls:/nm/TestDomain>nmStart('AdminServer')
starting server AdminServer
Server AdminServer started successfully
wls:/nm/TestDomain>

Monitor the status of the server using the NodeManager by entering the nmServerStatuscommand:

wls:/nm/TestDomain>nmServerStatus('AdminServer')
RUNNING
wls:/nm/TestDomain>

Example for starting the NodeManager and then the AdminServer with the NodeManager:

print 'Start the NodeManager';
startNodeManager(verbose='false',NodeManagerHome='/opt/wls/nodemanager/xyz', ListenPort='5556');

print 'Wait for a short time to allow the nodemanager to start ...'

print 'Connect to the Node Manager';
nmConnect(<user>,<password>, 'localhost', '5556', <domainName>, <domainLocation>, 'plain');


print 'Start the AdminServer using the NodeManager';
nmStart('AdminServer');

print 'Again wait for a short while to allow the AdminServer to start ...'

print 'Connect to the AdminServer';
connect(<user>, <password>, <url>);

It is better and much more secure to use the secret key files as there is no need to provide user and password in the readable script. This is also available for the NodeManager:

nmConnect([userConfigFile, userKeyFile], [host], [port], [domainName], [domainDir], [nmType])

Exp;-

print 'Start the NodeManager';
startNodeManager(verbose='false',NodeManagerHome='/opt/wls/nodemanager/xyz', ListenPort='5556');

print 'Wait for a short time to allow the nodemanager to start ...'

print 'Connect to the Node Manager';
nmConnect(userConfigFile='/opt/domainaccess/testNM/user', userKeyFile='/opt/domainaccess/testNM/key','localhost','5556',<domainName>, <domainLocation>, 'plain');

print 'Start the AdminServer using the NodeManager';
nmStart('AdminServer');

print 'Again wait for a short while to allow the AdminServer to start ...'

print 'Connect to the AdminServer';
connect(userConfigFile='/opt/domainaccess/testDomain/user', userKeyFile='/opt/domainaccess/testDomain/key', <url>);

Using WLST without NodeManager

Using the WLST startServer command, the administration server can be started without using a NodeManager. The server runs in a separate process from WLST, which means that exiting WLST does not shutdown the server.

startServer([adminServerName], [domainName], [url], [username], [password],[domainDir], [block], [timeout], [serverLog], [systemProperties], [jvmArgs])

Exp:-

wls:/offline> startServer('AdminServer','TestDomain','t3://myTestServer:12345',
'admin','<pw>5','/application/domains/TestDomain','false',60000,jvmArgs='-XX:MaxPermSize=125m, -Xmx512m, -XX:+UseParallelGC')
wls:/offline>

WLST Managed-Server
Similar to the AdminServer, WebLogic also offers different ways to start managed-servers. However, these differ from the possible ways to start an administration server.  The big difference is that the administration server is already running and can be used (and will be used) to start the managed-servers.

Using the start script

Similar to the admin server, WebLogic creates a startscript in the bin folder of the domain during domain creation. This can be used to start the different managed-servers by calling the script with the managed-server?s name. This script is called startManagedWebLogic.sh.

Using the NodeManager

If the domain is enrolled with the NodeManager and the server start attributes are configured correctly, then WLST can communicate with the NodeManager and start the server based on the configuration.

start('Test_Domain_MS1','Server')

This requires that the NodeManager on the target machine is started, the domain is enrolled, and the server start attributes are configured.

The managed-server can also be started using the AdminServer and the ServerLifeCycleRuntimeof the managed-server. This also requires that the NodeManager responsible for this managed-server is started.

connect('weblogic','xxxxx','t3://localhost:12345')
domainRuntime()
wls:/Test_Domain/domainRuntime>


cd ('/ServerLifeCycleRuntimes/Test_Domain_MS1')

cmo.start()

0 comments:

Post a Comment