wf3815v12_wsadmin & cmd

Download WF3815V12_wsadmin & cmd

Post on 05-Apr-2015

158 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

Welcome to:

wsadmin and Command Line Tools

Unit ObjectivesAfter completing this unit, you should be able to: Understand how wsadmin works Understand the various options for invoking wsadmin Understand JACL scripting and its appropriate use Understand how wsadmin fits into the BSF Describe the differences in managing applications, configurations and running objects Demonstrate the differences between the AdminConfig, AdminApp and AdminControl objects Understand the functionality of the command line tools available with the product

wsadmin OverviewScripting interface for WebSphere Application Server V5.0 Full support for all Tcl commands through Java Command Language (JACL), which is based on Tcl Available for all versions of WebSphere Application Server V5.0 Based on Bean Scripting Framework (BSF) Provides scripting and programming model similar to Java JACL is currently the only supported language

wsadmin Administrative FunctionsWebSphere Application Server system management separates administrative functions into two categories: Configuration of WebSphere Application Server installations (repository) Running objects in WebSphere Application Server installationsRepository Repository Running Application Server

wsadmin - How does it work?wsadmin acts as an interface to Java objects for access by scripts wsadmin uses the same interface (through JMX) as the Administrative Console to make configuration changes and control servers There are four Java objects that perform different operations AdminConfig - create/change WebSphere Application Server "static" configuration AdminApp - install, modify or administer applications AdminControl - work with "live" running objects, perform traces and data type conversion Help - display information and details about which MBeans are runningm Ad Config Admin pp inA

MBean

MBean MBean MBean

Script(s)

Wsadmin

AdminControl

He

lp

Resources

Invoking wsadminThree ways to invoke wsadmin:Command option wsadmin [-c command]

Script file

wsadmin [-f scriptfile]

Interactively

wsadmin

AdminConfig Managing ConfigurationsConfiguration management scripts use the AdminConfig object to access the repository where configuration information is stored AdminConfig Example: Output

Use the AdminConfig object to: List configuration objects and their attributes Create configuration objects Modify configuration objects Remove configuration objects Obtain help

AdminApp Managing ApplicationsApplication management scripts use the AdminApp object to manage applications in the application server configuration. Example:

Use the AdminApp object to: Install and uninstall applications List installed applications Edit application configurations Obtain help

AdminControl Managing Running ObjectsOperation management scripts use the AdminControl object to communicate with the MBeans that represent running objects. AdminControl Example:

Output

Use the AdminControl object to: List running objects and their attributes Invoke actions on running objects Obtain dynamic information about Mbeans that represent running objects Obtain help

Scripting and JACLVery beneficial for production environments with multiple nodes Allows multiple configuration changes/updates to be applied to all targeted resources in an efficient manner JACL presents an initial learning curve to the administrator not familiar with Tcl or scripting JACLs interpreter is written entirely in Java JACL can run on any Java Virtual Machine (JVM)

JACL 101############################################# # Use of set, variable and $ # ############################################# set node [$AdminConfig list Node] $AdminConfig show $node

Variable############################################# # Use of foreach, puts and show # ############################################# set serverlist [$AdminConfig list Server] foreach i $serverlist {puts "$i \n[$AdminConfig show $i]"}

Loop through a set of values

Loop variable

Output the details of each server

Scripts can be saved to .jacl files

JACL 101 - another example############################################# # Create an application server # ############################################# set node [$AdminConfig list Node] set server [$AdminConfig create Server [$AdminConfig getid /Node:$node/] {{name NewServer}}] $AdminConfig save set sid [$AdminConfig getid /Node:$node/Server:$server/] ############################################# # Modify the JVM settings # ############################################# set jvmid [$AdminConfig list JavaVirtualMachine $sid] $AdminConfig modify $jvmid {{initialHeapSize 128} {maximumHeapSize 256}} $AdminConfig save ############################################# # Start the server # ############################################# $AdminControl startServer $server $node

Changes are persisted when $AdminConfig save is called

wsadmin - Important Points to RememberCommands are case-sensitive wsadmin -f "scriptfile" is much faster than wsadmin -c "command" Better to run multiple commands in a file than individual commands Saving configuration changes is a two step process: first part validates the changes second part performs the save but will throw an exception if changes already made (example: creating two servers with the same name) Call $AdminConfig save periodically in the script file to persist configuration updates to existing objects

ProfilesProfiles allow you to customize the environment in which a script runs Profiles are stored in a jacl file Profiles run before any wsadmin commands Can be specified in two ways: Using the profile optionwsadmin profile c:\your_profile1.jacl

In the wsadmin.properties filecom.ibm.ws.scripting.profiles=c:/your_profile1.jacl

This could be used to: Enable and disable global security Enable and disable LTPA_LDAP security

SecurityThere are two security profiles that allow you to manage security configuration securityProcs.jacl Allows you to enable/disable global security Sets the user ID/password for LocalOS security LTPA_LDAPSecurityProcs.jacl Configures appropriate parameters for non-LocalOS security

Security (continued)If security is enabled, authentication information must be supplied for server communication Userid and password can be supplied at the wsadmin command line or in sas.client.props file

TracingTracing can be enabled through the AdminControl object Trace command changes the trace settings for the current session only Enable tracing with the following command: $AdminControl trace com.ibm.*=all=enable Disable tracing with the following command: $AdminControl trace com.ibm.*=all=disable

AntApache Ant is a Java-based build tool Similar to Make Uses Java classes instead of shell commands Uses XML file to specify build tasks WebSphere Application Server includes Ant tasks to: Install and uninstall applications Run EJB deployment and JSP pre-compilation tools Start and stop servers Run administrative scripts or commands For details of tasks see Javadoc for package com.ibm.websphere.ant.tasks For information about Ant see http://jakarta.apache.org/ant/index.html To run Ant use command ws_ant

Command Line ToolsThere are a number command line tools that are useful for working with local nodes and servers wsadmin is the best tool to use when administering remote machines The available tools can help you to: Start and stop servers Configure nodes Create and delete messaging components Backup and restore configurations Run deployment tools

Controlling ServersstartServer Launches a new JVM to run a server Can also write the launch command to a file Example: startServer server1 stopServer Stops the specified server serverStatus Obtains the status of one or all the servers on a node Example: serverStatus all Also: startNode / stopNode for the Node Agent startManager / stopManager for the Deployment Manager

Configuring NodesaddNode Adds a node to an existing cell Connects to the JMS port on the deployment manager Use -includeapps option to copy applications to cell config Examples:addNode mydmgr 8879 addNode mydmgr 8879 -includeapps

removeNode Removes a node from a cell Returns the node to its previous standalone configuration cleanupNode Deletes a node from the master configuration Use on deployment manager to cleanup a failed node syncNode Pulls configuration changes to the node Useful if you have disabled automatic synchronization

Configuring Messagingcreatemq Creates for the node:The messaging broker Queue Manager Supporting messaging objects

deletemq Deletes for the node:The messaging broker Queue Manager Supporting messaging objects

This command does not uninstall the WebSphere MQ or broker products

Managing Configuration DatabackupConfig Backs up the configuration of the node to a zip file All servers will be stopped first Default file name is: WebSphereConfig_yyyy-mm-dd.zip in the bin directory restoreConfig Restores the configuration of the node from the zip file created by the backupConfig command Usage: restoreConfig backup_file

Other Configuration and Deployment Toolsassembly Run Application Assembly Tool clientConfig Run Application Client Resource Configuration Tool earconvert Convert J2EE 1.2 ear file to 1.3 EARExpander Expand ear file to directory or collapse to file ejbdeploy Deploy EJBs in an ear file GenPluginCfg Regenerate plug-in configuration ikeyman Run IBM Key Management Utility to create SSL keys JspBatchCompiler Compile JSPs in an installed application PropFilePasswordEncoder Encode passwords in properties files SoapEarEnabler Add SOAP administration tool to an ear file

Unit SummaryDiscussed the functionality of wsadm