Sunday, May 1, 2011

Basic WebSphere Application Server Administration using wsadmin

This one is not a code snippet, but just some wsadmin commands to perform some basic administration of WebSphere Application Server.

Starting admin app

cd D:\Program Files\IBM\SDP70\runtimes\base_v61\profiles\AppSrv01\bin
wsadmin.bat -username admin -password admin


Install WAR

wsadmin>$AdminApp install "c:/ra/raks/blah.war" {-contextroot /osgi -defaultbinding.virtual.host default_host -usedefaultbindings}
#-Note the 'front slashes' (/) in the path of the war file
#-The extra arguments are passed in {}
wsadmin>$AdminConfig save


Starting application

wsadmin>set appManager [$AdminControl queryNames type=ApplicationManager,*]
wsadmin>$AdminControl invoke $appManager startApplication myApplication


Uninstall App

$AdminApp uninstall appName


Running a Jython wasadmin script

cd D:\Program Files\IBM\SDP70\runtimes\base_v61\profiles\AppSrv01\bin
>wsadmin.bat -lang jython -f c:/installApp.py [script-params]


Getting heapdump of Websphere server

wsadmin>set objectName [$AdminControl queryNames WebSphere:type=JVM,process=,node=,*]
wsadmin>$AdminControl invoke $objectName generateHeapDump


Exporting WebSphere profile configuration as CAR File

wsadmin>$AdminTask exportWasprofile {-archive appsrv01_profile.car}


Importing WebSphere profile configuration from a CAR File

>sftp user@servername:/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/appsrv01_profile.car .
wsadmin>$AdminTask importWasprofile {-archive appsrv01_profile.car}
wsadmin>$AdminConfig save


Finding and cancelling EJB Timer

/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin> findEJBTimers.sh server1 -all
Output:
ADMU0116I: Tool information is being logged in file
           /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/server1/EJBTimers.log
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: server1
Xlib: connection to "localhost:10.0" refused by server
Xlib: PuTTY X11 proxy: MIT-MAGIC-COOKIE-1 data did not match
Realm/Cell Name: 
Username: admin
Password:
EJB Timer : 2552     Expiration: 4/27/11 11:31 AM     Repeating
   EJB    : EAR, Business.jar, SchedulerServiceEJB
   EJB Key: Not Available
   Info   : SchedulerData@4bc84bc8[...]
1 EJB Timer tasks found

Use the timer id from the output (EJB Timer : 2552) and issue this command to cancel the timer.
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin> cancelEJBTimers.sh server1 -timer 2552
Output:
ADMU0116I: Tool information is being logged in file
           /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/server1/EJBTimers.log
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: server1
Xlib: connection to "localhost:10.0" refused by server
Xlib: PuTTY X11 proxy: MIT-MAGIC-COOKIE-1 data did not match
Realm/Cell Name: 
Username: admin
Password:
EJB Timer : 2552     Expiration: 4/27/11 11:31 AM     Repeating
   EJB    : EAR, Business.jar, SchedulerServiceEJB
   EJB Key: Not Available
   Info   : SchedulerData@4d1d4d1d[...]
1 EJB Timer tasks cancelled

No comments:

Post a Comment