WebSphere Administration

57
© 2004 IBM Corporation WebSphere UK User Group - October 2004 IBM Software Group WebSphere Administration A practical guide to WebSphere scripted administration options Andrew Simms, Consulting IT Specialist IBM SWG WebSphere Services [email protected]

Transcript of WebSphere Administration

Page 1: WebSphere Administration

© 2004 IBM CorporationWebSphere UK User Group - October 2004

IBM Software Group

WebSphere AdministrationA practical guide to WebSphere scripted administration options

Andrew Simms, Consulting IT SpecialistIBM SWG WebSphere [email protected]

Page 2: WebSphere Administration

2

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

WebSphere Administration: What we’ll cover

Page 3: WebSphere Administration

3

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

What we’re going to do . . .Talk through and demonstrate configuration scripts that:

o set the initial heap and maximum heap sizeo add or change environment entrieso set the maximum requests per keep-alive value of a particular transporto display the changed values

Talk through and demonstrate application deployment scripts.From these hope to see the relative merits of each tool

Page 4: WebSphere Administration

4

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

Tool 1: The Admin ConsoleYou could avoid writing scripts by using the Admin Console to perform configuration tasks and install applicationsIf you like typing and don’t make mistakes, this is the tool for youGoing to:

o select server1o navigate to Process Definition + Java Virtual Machine and change heap sizeso navigate to Process Definition + Environment Entries and change envvarso navigate to Web Container + HTTP Transports, select the SSL-disabled

transport, select Custom Properties and add a new propertyo install an application

Similar navigation on v4http://ajsnode1:9090/admin

Page 5: WebSphere Administration

5

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

Admin Console: CommentsDifferent look and feel in v4 and v5v5.1 & v6 have same look and feel as v5Use for ad hoc configuration and operational tasks, e.g.:

o building a playpen environmento examining transactionso examining product informationo controlling trace and examining logs

Avoid for bulk and repetitive tasksUseful early in the test cycleUse when some task is just too difficult or expensive to script

Page 6: WebSphere Administration

6

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

So why not just use the Admin Console?Consider:

o you have N1 domains/cellso N2 test environmentso N3 application servers or server groups (clusters) in each domain/cello N4 enterprise applicationso N5 drops received from development for each app

If Ni ≈ 1 for each i, then you could use the Admin ConsoleWhen Ni >> 1 then using Admin Console becomes tedious and error prone Solution: script domain/cell builds and enterprise application installationsUp front cost but in the long term you save administrator costs and provide a more reliable service.

Page 7: WebSphere Administration

7

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

Tool 2: wscpWhat is it?

o v4’s configuration and runtime scripting languageMain features:

o Extension of Tcl, the Tool Command Language• Tcl is portable across many platforms• Tcl widely used for scripting tasks, not just WebSphere• Simple to learn, powerful to use

o Interactive or scripted accesso Typically used for bulk and repeatable tasks, e.g.:

• Add a set of definitions in a repeatable manner• Change the value of a system property on all servers in all domains (but

not easily)o Can do most things that can be done in the Admin Console

Page 8: WebSphere Administration

8

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

wscp: Style of usageCommand line /scriptThree modes of operation:

o interactiveo single command (-c option)o run a script (-f option)

Access resources using <class> <verb> <object> <options>, e.g.:o J2CResourceAdapter create <name> –attribute {{Name fred}

{ArchiveFile freda}}

Names look like this:o /Node:ajsnode/Server:server1/o /JDBCDriver:schumacher/DataSource:button/

Lots of curly brackets!!, e.g.:o ServerGroup show <name> –attribute EJBServerAttributeso ServerGroup modify <name> -attribute {{EJBServerAttributes

{WebContainerConfig {SessionManagerConfig {EnableUrlRewriting true}}}}}

Page 9: WebSphere Administration

9

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

wscp: Example CodeCode:

o sample_wscp.tcl (about 90 lines)o sample_wscp_install.tcl (about 20 lines)

Reset before running:o sample_swan_reset_wscp.bat

Run it:o sample_wscp.bato sample_wscp_install.bat

Page 10: WebSphere Administration

10

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

Tool 3: XMLConfigWhat is it?

o v4’s XML configuration utilityMain features:

o Private to WebSphere, unlike Tclo Exports full or partial repository to an XML fileo Imports from XML file with arbitrary substitutionso Not interactive (but can be called interactively from wscp)o Can create, update or delete objectso Can start/stop objectso Typically used for repeatable tasks, e.g.:

• Add a set of definitions in a repeatable mannero Can be invoked from Admin Console, shell or wscp

Page 11: WebSphere Administration

11

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

XMLConfig: Style of UsageCommandRun xmlconfig –export to export the entire domain to an XML fileRun xmlconfig –export –partial <file> to export part of a domain to an XML file, where <file> directs what is to be exportedEdit the generated XML file:

o remove unwanted bitso change values to variable names to allow substitution

Run xmlconfig –import to import from the XML file to a new or the same domain, usually with substitutionsCan also build the XML file by hand

Page 12: WebSphere Administration

12

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

XMLConfig: Example CodeCode:

o sample_xmlconfig_partial_export.xml (7 lines)o sample_xmlconfig_partial_export_output.xml (c200 lines, generated)o sample_xmlconfig_import.xml (50 lines, edited)o sample_xmlconfig_partial_export_install.xml (5 lines)o sample_xmlconfig_partial_export_output_install.xml (c70 lines, generated

& edited)Reset before running:

o sample_swan_reset_wscp.batRun it:

o sample_xmlconfig.bato sample_xmlconfig_install.bat

Page 13: WebSphere Administration

13

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

wscp is better than XMLConfig is better than wscp

Export+partial can do some ad hoc tasksCan be used for ad hoc purposes interactively (but not always easily)

Is dependent on creating something first manually (unless you create the XML by hand)

Is not dependent on having something built manually first

Is a good choice for repetitive tasks where changes are simple substitutions

Is a natural choice for doing anything in bulk or repetitive

Places actions in XML attributes (rather like ANT)

Represents WebSphere objects as commands (e.g. ApplicationServer) with verbs (e.g. “start”, “modify”)

Its output is XML, but the utility is unique to WebSphere

Is based on a Java implementation of a popular scripting language (Tcl)

Is a utility that allows simple substitutions and has limited actions

Is a powerful procedural scripting languagewith variables

XMLConfigwscp

Page 14: WebSphere Administration

14

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

Scripted options in v5 & v5.1 & v6Gone!Replacement for wscp: wsadmin

o But provides a completely different set of objectso wscp scripts are not migratable to wsadmin

Replacement for XMLConfig: nothingo Repository now a set of XML fileso Expectation that customers would copy/edit directories/fileso Proved too hardo Some as-is scripts available on WebSphere Developer Domain for doing

XMLConfig-like things (v5.1.2)o Some more XMLConfig-like things in v6 and beyond

Page 15: WebSphere Administration

15

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

Tool 4: wsadminWhat is it?

o v5’s scripting languageMain features:

o Uses the Bean Scripting Framework (BSF)• Provides access to Java objects and methods from supported scripting

languages. • Architecture for easily incorporating scripting into Java applications

and applets• Applications independent and not bound to a single scripting language • Different language scripts can access Java objects using wsadmin

o Current supported languages for wsadmin:• Jacl - Java Command Language based on Tcl scripting• Jython – Java implementation of the OO language Python

Page 16: WebSphere Administration

16

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

Tool 4: wsadminHow is it different from wscp?

o The WebSphere objects are completely different from wscpo Tcl is easy to learn, but wsadmin is complexo Separates static configuration from dynamic changes

Typically used for bulk and repeatable tasks, e.g.:o Add a set of definitions in a repeatable mannero Change the value of an environment variable on all servers in all cells

Can do everything in the Admin Console, but not in a necessarily intuitive manner

Page 17: WebSphere Administration

17

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

wsadmin: JMX MBeanswsadmin acts as an interface to Java objects for access by scripts

o Objects communicate with MBeans (JMX management objects)Objects perform different operations. There are four built-in objects:

o $AdminConfig (Jacl) or AdminConfig (Jython)• Create or change the WebSphere configuration

o $AdminApp (Jacl) or AdminApp (Jython)• Install, modify, or administer applications

o $AdminControl (Jacl) or AdminControl (Jython)• Work with live running objects and perform traces and data type conversion

o $Help (Jacl) or Help (Jython)• Display general help information and details about which MBeans are running

Separation between Configuration and Control

wsadmin

MBean

MBean

MBeanHelp

AdminApp

AdminConfigAdminControl

MBean

ScriptScript

Page 18: WebSphere Administration

18

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

wsadmin: Style of usageCommand line / scriptThree modes of operation:

o interactiveo single command (-c option)o run a script (-f option)

Connect over SOAP or RMIPass language identifier to wsadmin command – Jacl assumedAccess configuration resources using AdminConfig. In Jacl:

o set id [$AdminConfig getid <name>]o $AdminConfig modify $id {{name fred} {desc “fred bloggs”}}

And in Jython:o id = AdminConfig.getid(<name>)o AdminConfig.modify(id, “[[name fred], [desc ““fred bloggs””]]”

Configuration names look like this:o /Cell:ajs_cell/Node:ajsnode/Server:server1/o /JDBCProvider:schumacher/DataSource:button/

Page 19: WebSphere Administration

19

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

wsadmin: Style of usage (2)Access runtime resources using AdminControl. In Jacl:

o set mbeanId [$AdminConfig getObjectName $id]o $AdminControl invoke $mbeanId getState

And in Jython:o mbeanId = AdminConfig.getObjectName($id)o AdminControl.invoke(mbeanId, getState)

Runtime names look like this:o WebSphere:platform=common,cell=ajs_cell,version=5.0.1,name=NodeAgen

t,mbeanIdentifier=NodeAgent,type=NodeAgent,node=ajsnode1,process=nodeagent

Page 20: WebSphere Administration

20

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

wsadmin: Some Operations and Functions$AdminConfig

o attributeso convertToClustero createo createClusterMembero createUsingTemplateo defaultso getido getObjectNameo installResourceAdaptero listo listTemplateso modifyo parentso reseto saveo showo showallo showAttributeo types

$AdminAppo deleteUserAndGroupEntrieso edito editInteractiveo exporto exportDDLo installo installInteractiveo listo listModuleso optionso publishWSDLo taskInfoo uninstall

$AdminControlo completeObjectNameo getAttributeo getAttributeso getCello getConfigIdo getHosto getMBeanCounto getNodeo getPorto getTypeo invokeo makeObjectNameo queryNameso setAttributeo setAttributeso startServero stopServero testConnectiono trace

$Helpo attributeso operationso constructorso descriptiono classnameo allo AdminControlo AdminAppo AdminConfigo wsadmino message

Page 21: WebSphere Administration

21

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

wsadmin: MiscellaneousCommands are case-sensitiveConfiguration changes not persisted until "save" callIf multiple scripts or clients (Administrative Console) are saving configuration changes at the same time, exception thrown on Save call

o No changes will be persistedUpon "save" call, validation procedure verifies updates

o Create two servers with the same name throws exceptionwsadmin -f "xxxxx" much faster than wsadmin -c "xxxxx"

o Better to run multiple commands in a file than individual commandso Call "save" in file periodically to persist configurations updates

• Avoids no changes being persisted should an exception occur

Page 22: WebSphere Administration

22

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

wsadmin: Installing an ApplicationUse $AdminAppCan use interactively inside a commandCan get the configurable options from an EAR file

o $AdminApp options myapp.ear

Then can get the task information for each option:o $AdminApp taskInfo myapp.ear MapWebModToVH

Could then use this info to help build the relevant options for installation:

o $AdminApp install myapp.ear {-appname freda -MapWebModToVH {{{Default Application} default_app.war,WEB-INF/web.xml myvhost}} -<lots of other options . . .>}

Just as difficult to construct this as in wscp

Page 23: WebSphere Administration

23

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

wsadmin: Example CodeJACL Code:

o sample_wsadmin.tcl (about 90 lines)o sample_wsadmin_install.tcl (about 25 lines)

Jython Code:o sample_wsadmin.py (about 90 lines)

Reset before running:o sample_swan_reset_wsadmin.bat

Run JACL:o sample_wsadmin_jacl.bato sample_wsadmin_install_jacl.bat

Reset before running:o sample_swan_reset_wsadmin.bat

Run Jython:o sample_wsadmin_py.bat

Page 24: WebSphere Administration

24

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

Jacl is better than Jython is better than JaclNot that differentIf you can program in one you can probably program in the otherJacl may suit shell script programmersJython may suit those with OO backgroundBoth take just as much as code as the other in our example

Page 25: WebSphere Administration

25

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

Tool 5: ws_ant (ANT)What is it?

o ANT – Java-based, platform-neutral, open source build toolo ws_ant: Copy of Apache ANT with task extensions to support WebSphere-

specific capabilitiesMain Features:

o Tasks provided include:• Install and uninstall applications• Start and stop servers• Run administration scripts or commands

o But the admin task is just a call to wsadmin – you still have to write the wsadmin code to do the actual configuration

o Main advantage is ability to build the EAR, run a configuration script and then install the EAR, all from a single ws_ant build.xml.

Page 26: WebSphere Administration

26

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

ws_ant: Style of UsageCommand-orientedSpecify tasks, targets and dependencies between targetsConnect over SOAP or RMIPass language identifier to wsadmin command – Jacl assumed

Page 27: WebSphere Administration

27

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

ws_ant: Example CodeCode:

o build.xml (45 lines)o sample.props (20 lines)

Reset:o sample_swan_reset_wsadmin.bat

Run it:o sample_wsant_wsadmin.bato sample_wsant_install.bat

Page 28: WebSphere Administration

28

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

Tool 6: WsAdmin Automation Platform (WAP)What is it?

o Set of utility functions sitting over wsadmino Eases a lot of wsadmin hassle

Main features:o Available from IBM Techdocs, the Technical Sales Libraryo Not supported by IBM: provided “as is”o Greatly simplifies many wsadmin scripting taskso Provides a library of Tcl procedures for creating, modifying and deleting WebSphere

objects (e.g. application servers, data sources)o Runs on 5.0 and 5.1o Syntax (on Windows):

• set WAP_SOURCE=/installed/wap• set PATH=%PATH%;%WAP_SOURCE%• jwap.bat

Page 29: WebSphere Administration

29

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

WAP: Style of usageCommand line / scriptRuns over wsadmin, so:

o Three modes of operation:• interactive• single command (-c option)• run a script (-f option)

o Connect over SOAP or RMIJacl only (not Jython)Set subsequent commands’ scope:

o setNode ajsnode1

o setServer server1

Provides a number of Jacl procedures named:o createXXX, removeXXX, modifyXXX

o e.g. createCustomService, modifyJDBCProviderPass parameters as dash-options, plus “you-name-it” options

Page 30: WebSphere Administration

30

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

WAP: Style of usage (2)Names become simpler (no need for /Cell:xxx/Node:xxx/Server:xxx/)Not all documented:

o getIDByListing & modifyConfigObject are not documented but very usefulMainly aimed at create/modify/delete

o little support for display & listo “list” does not return as Tcl lists so you can’t do “foreach” style processing

Page 31: WebSphere Administration

31

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

WAP: Example CodeCode:

o sample_wap.tcl (c90 lines)Reset:

o sample_swan_reset_wsadmin.batRun it:

o sample_wap.bat

Page 32: WebSphere Administration

32

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

WAP: Installing an application

Use the installApplication command

Pass customisations in same way as wsadmin’s $AdminApp install:installApplication -appname fred -earfile

/installed/websphere/appserver/base5.1/installableApps/ivtApp.ear \{-MapModulesToServers {{{IVT Application} ivt_app.war,WEB-INF/web.xml WebSphere:cell=ajs_cell,node=ajsnode1,server=server1}}}

-interact option to customise by answering questions (couldn’t get this to work)

Can install then customise afterwards using the editApplication command

Not really any different from $AdminApp

About 15 long statements in our example

Page 33: WebSphere Administration

33

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

Tool 7: JMXWhat is it?

o Java Management Extensions (JMX) is a framework oriented at managing applications and resources (like application servers)

• Allows for exposing your application to remote or local management tools• JMX is a specification oriented to the application and network management• Part of J2SE

Main Features:o Some of the JMX functionality:

• Allows you to query the configuration settings and change them at runtime• Provides services such as monitoring, event notification, timers, ....• Allows you to load, initialize, change, and monitor application components and

resourceso Structured in three layers:

• Instrumentation layer - MBeans• Agent layer - MBeanServer and agents• Distributed Services (this part is still out of the scope of the current level of the

specs)JSR-077

Page 34: WebSphere Administration

34

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

About JMX: How does JMX work?Resources are managed by Managed Beans (MBeans)

o These are simple JavaBeans that perform operational or configuration changes on resources

MBeans provide APIs to the external world to manage its resourceso Each JMX-enabled JVM contains a MBean Server (Managed Bean Server) that registers all the MBeans in the system

• MBean Server provides access to all of its registered MBeanso External programs access MBeans registered on the MBean Server via Connectors/Adapters

Resources

MBeans

MBeansMBeanServer

JVM

External tools and programs Connector

Page 35: WebSphere Administration

35

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

JMX Benefits

Enables Java applications to be managed without heavy investmento Relies on a core managed object server that act as a ‘management agent’o Java application simply needs to embed a managed object server and make some of its

functionality available as one or several Manageable Beans registered in the object server

Provides a scalable management architectureo Every JMX agent service is an independent module that can be plugged into the

management agentIntegrates existing management solutions

o JMX smart agents are capable of being managed through HTML browsers or by various management protocols such as Web Services, JMS, SNMP, etc.

Defines only the interfaces necessary for management

Page 36: WebSphere Administration

36

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

JMX: Architectural Principles

MBean Server

Connector Adapter

Managed Resources

Agent Services(as MBeans)

AgentServices

AgentServices

Resource 1MBean

Resource 1

Manages

Resource 2MBean

Resource 2

Manages

JVM

Management Application

Instrumentation Layer

Agent Layer

Page 37: WebSphere Administration

37

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

WebSphere JMX Architecture

All WebSphere 5.0 processes run the JMX agentAll WebSphere 5.0 runtime administration is done through JMX operations

W ebSphere Application Server Process

MBeanServer

MBeanProxy

MBeanProxy

HTTPJMX

Adapter

MBeans

MBeans

SNMPJMX

Adapter RMI/IIOPJMX

ConnectorSOAPJMX

Connector

internal runtime objects

External M BeanServer

External tools and program s

Internal M Beans register with local M BeanServer.External MBeans have local proxy to their M BeanServer. Proxy registers with local M BeanServer.

Illustrates possibilities or future plans

Page 38: WebSphere Administration

38

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

WebSphere Distributed Administration

Node Mgr

MBeanServer

Clients, Multi-cell mgmt, & other EMS

(Tivoli, BMC)

MBeanProxy

App Server

tmx4jMBeanServer

MBeanProxy

MBeans

MBeans

JMXConnector

EAR files

config filesMBean

Server

MBeans

MBeans

MBeans

MBeans

JMXConnector

MBeanServer

MBeanProxy

MBeanProxy

JMXConnector

MBeans

MBeans

Deployment Mgr

Config Distribution Service

Config Repository Service

To Other App Servers

To Other Nodes

Master files

Master files

Master files

Page 39: WebSphere Administration

39

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

JMX: Some MBeansCellNode ManagedObjectApplicationServer ServerClusterJMSServer Application, EJBModuleConfig, WebModuleConfig EJBContainer, WebContainer ListenerPortJMSProvider JMSConnectionFactory JMSDestinationJ2CResourceAdapter

J2CConnectionFactoryJavaMailProviderMailSession URLProvider URL JDBCProvider DataSource, WAS40DataSourceConnectionPool ORBPluginJavaVirtualMachine SecurityPermissionNameServer LocalOSUserRegistry

These Mbeans are built into WebSphere – 224

of them in v5.1

Page 40: WebSphere Administration

40

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

How Can Customers Use JMX?

All WAS 5.0 Admin client programs use JMX

o Web Admin console

o wsadmin scripting

o Admin Client Java API

o Included in both Base App Server package and Advanced Deployment

Use the APIs to control WebSphere runtime

Extend the set of managed objects with custom JMX MBeans

Attach Admin clients to Cell Manager in order to access entire Admin domain

Node Agents start & monitor individual App Servers

Page 41: WebSphere Administration

41

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

JMX: Example CodeCode:

o sample_jmx.java (c160 lines)Reset:

o sample_swan_reset_wsadmin.batRun it:

o sample_jmx.bat

Page 42: WebSphere Administration

42

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

Tool 8: SWANWhat is it?

o Simplified WebSphere AdministratioNo Greatly eases wscp and wsadmin hassle

Main features:o Runs in wscp and wsadmino Obtainable from the authoro Runs on WebSphere v4, v5, v5.1o Runs on Windows, AIX (probably all UNIXes) and z/OSo Simplifies writing wscp and wsadmin scriptso Simplifies interactive accesso Provides a high degree of portability between WebSphere versions

SWAN

wscp wsadmin

Page 43: WebSphere Administration

43

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

SWAN Syntax<class> <verb> [<object>] [<options>] [<attributes>]Examples:

o appserv listo dsource list –format -shorto jcafact delete jack –ra jillo resadapt create ada –rarfile /usr/product/somefile.raro cluster show clouseau +maxheap +minheapo appserv show jeeves +webhttpbacklog –constraint {Host * Port 9080}o appserv modify jeeves +webhttpbacklog 53 –constraint {Host * Port 9080}o appserv modify –constraint {Host * Port 9080} +webhttpbacklog 57 jeeveso jmsdest exists jack –jmsprov jill

Page 44: WebSphere Administration

44

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

SWAN is better than wscp/wsadmin is better than SWAN

In wscp/wsadmin you have to know how to reach a particular attributeo Not a problem for many cases

• e.g. JDBCProvider has no attribute hierarchyo Big problem for server groups and application servers

• have to understand the hierarchy to navigate through ito SWAN solves this by hiding the hierarchy

In wscp/wsadmin you have long names:o Long names for configuration and runtime objectso Much of which is probably constant in your script (e.g. cell name & node

name)o SWAN solves this by setting a scope and providing the –short option

In wscp/wsadmin you need long Tcl lists to set attributes:o SWAN solves this because it has flattened the attribute hierarchy

wscp scripts cannot be migrated to wsadmin without complete rewriting:o But wscp scripts written to use the SWAN syntax will be migratableo Some changes will be needed though because of differences in v5

Page 45: WebSphere Administration

45

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

SWAN is better than wscp/wsadmin is better than SWAN

SWAN does not implement all of the object types:o There are 224 in wsadmin in v5.1o SWAN implements the most commonly used object typeso SWAN can be extended to implement the others – easily if they follow the

patterns of the current SWAN typeso You can always use the wsadmin types directly in your scripts

SWAN is not supported by IBM:o SWAN is provided as-iso Whereas wscp and wsadmin are supported

Page 46: WebSphere Administration

46

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

SWAN: Further Examples

Getting help:o helpo dsource helpo jdbcdrv help createo jcafact attributeso jcafact attributes -detailso cluster create clouseau -member sellers –vertical 3o cluster showmembers clouseauo appserv makecluster jeeves –cluster woostero cluster start wooster o cluster stop wooster -force

Page 47: WebSphere Administration

47

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

SWAN: Coverage

Resource adaptersresadapt

JMS connection factoriesjmsfactGeneric JMS providersjmsprovJava mailmailNode agentsnagent

J2C connection factoriesjcafact

Virtual hostsvhost

JMS destinationsjmsdestJDBC drivers (providers)jdbcdrv

Enterprise applicationsentappData sourcesdsourceClusters (server groups)clusterDomain or cellcellApplication serversappserv

Page 48: WebSphere Administration

48

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

Installing enterprise applications using SWANPackager or Deployer runs "entapp produceaid":

o Creates an XML file called an Enterprise Archive Application Installation Descriptor (EAR AID)

o EAR AID houses all of the deployable options from the EAR file'sdeployment descriptors

Intention is that the Deployer then edits this file using an XML or text editor to set appropriate values (as would be done through the console)Deployer then runs "entapp create":

o takes the EAR file and uses the AID file to install the enterprise appo same procedure whether v4 or v5, but different EAR AID file

Non-SWAN software available to produce an Excel spreadsheet containing the EAR AID file, and to transform it back

o makes it easier to edit

Page 49: WebSphere Administration

49

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

SWAN: Example CodeCode:

o sample_swan.tcl (25 lines, does both v4 and v5)Reset:

o sample_swan_reset_wscp.bato sample_swan_reset_wsadmin.bat

Run it:o sample_swan_wscp.bato sample_swan_wsadmin.bat

Page 50: WebSphere Administration

50

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

SWAN Internals: Code Size

1500Other common code

11,400Total non-commentary code

4,300Plus comment lines

1000Includes debug/trace code

900Common v5 code

1400Common v4 code

3600v5 code

3700v4 code

800Configuration files

# lines non-commentary codeFile Type

Page 51: WebSphere Administration

51

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

Configuration & Deployment Using SWAN (1)

Project-Specific Configuration Spreadsheetiwf_acm_iiw_app.cfg.xls

.ear .zip OtherArtefacts

Default Configuration Spreadsheet

1

PVCS

2

ReleaseNote

Edit in Excel

Page 52: WebSphere Administration

52

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

Configuration & Deployment Using SWAN (2)

.ear3 4

entappproduceaid

EARAID

GenerateSpreadsheet

5

Edit in Excel

Project-Specific Configuration Spreadsheet

EditedProject-Specific Configuration Spreadsheet

6

PVCS

AID Spreadsheetiwf_acm_iiw_app.xls

Page 53: WebSphere Administration

53

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

Configuration & Deployment Using SWAN (3)

7

9

Generator

Project-Specific Configuration Spreadsheet

Configurationscripts

Configurationscripts

Configurationscripts

.ear .zip OtherArtefacts

ReleaseNote

EditedEARAID

zip Package PVCS

AID Spreadsheet

Generator

8

Page 54: WebSphere Administration

54

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

Configuration & Deployment Using SWAN (4)

PackageTivoli Software

Distribution

Packageon node

A

10

ConfiguratorConfiguration

scriptsConfiguration

scriptsConfiguration

scripts12

WebSphereDomain

.earEditedEARAID

entapp create

13

14

i..edAppsEAR

15

Node A

Node B Node C Node D

Tivoli SoftwareDistribution

11

Page 55: WebSphere Administration

55

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

Tool 9: J2EE 1.4 Management and DeploymentWhat is it?

o J2EE 1.4 APIs for product-independent configuration & deploymentMain features:

o No standard up to J2EE 1.3o J2EE 1.4 (WebSphere v6) introduces:

• J2EE Management Specification (JSR-77)• ability to configure and control J2EE objects in a Java-application-

server-independent manner• J2EE Deployment Specification (JSR-88)

• ability to install enterprise applications in a Java-application-server-independent manner

• wsadmin still works• write programs to these specs to lessen vendor lock-in• many configuration/deployment possibilities:

• Admin Console• wsadmin scripts in Jacl and Jython• Programs written to the JMX API• Programs written to JSR-77 & JSR-88

Page 56: WebSphere Administration

56

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

Comparison: Lines of code

4??257520Installation

650?308(but displays everything)

30Display

340?2343Transport

63519246016Environment

2945 (plus wsadmin)

642Heap sizes

SWANJMXws_antwsadmin Jython

wsadminJacl

XmlConfigwscp

Page 57: WebSphere Administration

57

WebSphere Application Server

WebSphere UK User Group - October 2004© 2004 IBM Corporation

IBM Software Group | WebSphere software

SummaryReferences

o “IBM WebSphere System Administration” by Leigh Williamson et al (ISBN: 0-13-144604-5)

o “IBM WebSphere Deployment and Advanced Configuration” by Barcia/Hines/Alcott/Botzum (ISBN: 0-13-146862-6)

o WAP:• http://www-1.ibm.com/support/techdocs/atsmastr.nsf/WebIndex/PRS981

o SWAN:• [email protected]