Ibm Websphere Application Server V7 Properties-File-Based Configuration
Ibm Websphere Application Server V7 Properties-File-Based Configuration
Ganesan Karuppaiah
1
IBM Software Group
Agenda
Overview
Introduction to PropertiesBasedConfiguration
Extracting properties from configuration files.
Validating properties files.
Applying properties files to configuration.
Creating properties file Templates.
Creating and deleting configuration objects using
properties files examples.
Additional WebSphere Product Resources/Links
Questions?
2
IBM Software Group
Overview
WebSphere Application Server configuration
repository consists of multiple files in XML and
other formats, spread across many directories.
These configuration objects are complex.
Property files, consisting of name/value
pairs, are more human readable than
other configuration files.
Similar to the old XMLConfig export/import
commands in WebSphere V3.5 and V4
Until WebSphere version V4, separate relational database was used for
WebSphere configuration data. Along with command line tool wscp
(WebSphere Control Program) we also had another tool "XMLConfig". This
XMLConfig is used to export and import data from database repository.
Using this, WebSphere administrator can extract (export) the WebSphere
configuration from database to a single xml file.
Starting from V5, WebSphere started using xml based configuration files and moved
away from database dependencies for its configuration repositories. During
this change XMLConfig feature did not make it to V5 and from V5 onwards
WebSphere administrators are left with 3 choices. Console, wsadmin, and
Public JMX APIs.
Console is very easy to navigate. Few customer use custom built JMX programs
(using WebSphere APIs) for their administration. Majority of the WebSphere
administrators are using “wsadmin” as their favorite command line
administration tool. Though we have provided a list of sample commands in
our information center, basic understanding of jython/jacl is needed to use
wsadmin tool more effectively.
3
IBM Software Group
PropertiesBasedConfiguration
WebSphere Application Server V7.0 introduces a simple
properties file based configuration feature that can be used
as a tool for querying and modifying configuration objects.
Application servers
Nodes
Profiles
Virtual hosts
Authorization tables
Data replication domains
Variable maps
Java™ Database Connectivity (JDBC) providers
Uniform Resource Locator (URL) providers
Mail providers
Resource environment providers
Java™ 2 Connector (J2C) resource adapters
4
IBM Software Group
PropertiesBasedConfiguration
Properties file based configuration is not a replacement for
configuration archives and these commands do not extract
all configuration attributes, only the most commonly used.
You can extract the configuration attributes and values
from your environment to properties files.
Copy configuration properties from one environment to
another.
Troubleshoot configuration issues. Apply one set of
configuration properties across multiple profiles,nodes,
cells, servers, or applications.
5
IBM Software Group
PropertiesBasedConfiguration
AdminTask Description
AdminTask.extractConfigProperties Extracts configuration data in the form of
a properties file
6
IBM Software Group
Properties File
# Configuration properties file for cells/KenGNode05Cell/nodes/TestProfileNode01/servers/server1|server.xml#
# Extracted on Tue Aug 04 10:11:24 EDT 2009
# 1. Header
#
# Section 1.0 ## Cell=!{cellName}:Node=!{nodeName}:Server=!{serverName}
#
# SubSection 1.0 # Server Section
ResourceType=Server
ImplementingResourceType=Server
ResourceId=Cell=!{cellName}:Node=!{nodeName}:Server=!{serverName}
#
#Properties 2. Properties
shortName=null
serverType=APPLICATION_SERVER #readonly
developmentMode=false #boolean
parallelStartEnabled=true #boolean
name=!{serverName}
clusterName=null
uniqueId=null
modelId=null
3. Environment Variables
.....
#Environment Variables
cellName=KenGCell01
nodeName=KenGNode01
hostName=KenG
serverName=server1
Properties file is divided into multiple sections. Each section contains one
configuration object with header, properties and environment variables.
1. The information in the header is generated automatically, and only ResourceId
should ever be modified. This information is present so that the properties file
based configuration tool knows which implementation to invoke and apply
properties. Header contains:
ResourceType: Indicates the type of resource.
ResourceId: Its a name that uniquely identifies the resource or configuration object.
This should only be modified when the same properties need to be applied to
another object of same type.
ImplementingResourceType : Indicates the class that implements the translation of
attributes to properties.
2.Properties section contains properties of the configuration object identified by the
header, in name/value pairs. Each name and value corresponds to an attribute of
the configuration object.
3.Environment Variables section contains values for variables used within the
properties file. Environment specific properties, such as cellName, serverName,
nodeName, and so on are expressed as variables and the current values of those
variables are placed at the end of the properties file. Having all the variables listed
separately makes it easy to edit.
7
IBM Software Group
Properties File
Most Common Parameters & Rules.
#
ResourceType=VirtualHost
AttributeInfo=aliases(port,hostname)
#
ResourceType=J2CResourceAdapter
classpath={${WAS_LIBS_DIR}/rsadapter.rar}
name=WebSphere Relational Resource Adapter #readonly
#
ResourceType=JavaVirtualMachine
initialHeapSize=0 #integer
verboseModeGarbageCollection=false #boolean
executableJarFileName=null
#
ResourceType=ActivationSpecTemplateProps
destinationType=javax.jms.Queue #String,required
#
ResourceType=SessionDatabasePersistence
datasourceJNDIName="jdbc/Sessions"
8
IBM Software Group
Properties File
Special properties
# Create parameters# Replace the line `SKIP=true` with 'SKIP=false' under each section that is needed
# Set necessary parameters under each command or step sections
# Invoke applyConfigProperties command using this properties file.
# Use this section to install a new application on a given server.
# Update ResourceId field with appname ( ResourceId=Deployment=appName )
#
ResourceType=Application
ImplementingResourceType=Application
ResourceId=Deployment=
SKIP=true
CreateDeleteCommandProperties=true
#
#Properties
EarFileLocation=location of earfile #required
Name=appName #required
TargetNode=targetNodeName #required
TargetServer=targetServerName #required
SKIP
Every section can have a SKIP property set to true or false.
Example: SKIP=true
SKIPSUBSECTIONS
When this property is present in a section and is set to true, all the subsections are
skipped.
Example: SKIPSUBSECTIONS=true
DELETE
When this property is present in a section and is set to true, that section will be
deleted completely from the configuration.
Example: DELETE=true
This property is only used by deleteConfigProperties commands. Default value is
false.
9
IBM Software Group
Optional parameters
-configData Configuration Object instance. Ex:Node=node1
Use the configData parameter to specify a Server, Node,
Cluster, or Application instance. If configData is not
specified, the command extracts the cell configuration data.
-filterMechanism Options
All: To extract all configuration properties.
NO_SUBTYPES: To extract the properties of the given object without including the
subtypes.
10
IBM Software Group
configData: To specify the type of resources. Available types are Server, Node,
Cluster and Application
11
IBM Software Group
12
IBM Software Group
Validating/Applying/Deleting configuration
Required parameters
-propertiesFileName Name of the properties file to extract
Optional parameters
-variablesMapFileName Specifies the name of the variables map file. This file contains values
for variables that the system uses from the properties file.
-variablesMap Specifies the [variables values] pair to use with the properties file.
-reportFileName Specifies the name of a report file that contains the output for the
applyConfigProperties command.
-reportFilterMechanism Specifies the type of report filter mechanism. Specify All to display
all report information. Specify Errors to display error information.
Specify Errors_And_Changes to display error and change
information.
-validate Specifies whether to validate the properties file before applying the
changes. By default, the command validates the properties file.
Specify false to disable validation.
13
IBM Software Group
2. AdminTask.validateConfigProperties('[-propertiesFileName
myNode.props -reportFileName myReport.txt ]')
3. AdminTask.validateConfigProperties('[-propertiesFileName
myNode.props -reportFileName myReport.txt -
reportFilterMechanism Errors_And_Changes]')
4. AdminTask.validateConfigProperties('[-propertiesFileName
myNode.props -variablesMapFileName myNode.props.vars -
reportFileName myReport.txt –reportFilterMechanism
Errors_And_Changes]‘)
4. During validation any existing variable property file can be validated along with
–variablesMapFileName option.
14
IBM Software Group
After any configuration changes save operation used to save the changes to xml
configuration files. Not using save will not post the changes to configuration files.
15
IBM Software Group
wsadmin>AdminTask.createPropertiesFileTemplates('[-
propertiesFileName myServer.template -configType Server]')
wsadmin>
16
IBM Software Group
17
IBM Software Group
18
IBM Software Group
Always make a back-up copy of the properties file before you edit it.
19
IBM Software Group
We are trying to remove xmi ids from the properties file altogether.
That way one can use some other attribute as key to identify an object uniquely. In
this case alias could be used. This feature is in consideration.
20
IBM Software Group
Install an application
Description Command
Create a properties AdminTask.createPropertiesFileTemplates(‘-propertiesFileName
file template for app.props –configType Application')
application install
Update the file ResourceType=Application
app.props to contain ImplementingResourceType=Application
the require values for ResourceId=Deployment=
the application you SKIP=false
are installing CreateDeleteCommandProperties=true
#
#Properties
#
EarFileLocation=location of earfile #required
Name=appName #required
TargetNode=targetNodeName #required
TargetServer=targetServerName #required
Apply the properties AdminTask.applyConfigProperties(‘-propertiesFileName
file app.props ’)
Save changes AdminConfig.save()
21
IBM Software Group
Summary
Properties file based configuration is a new method for
working with an application server configuration.
Uses wsadmin commands and simple name/value
property files.
Makes configuration automation easier
Copy configuration properties from one environment to
another.
Troubleshoot configuration issues.
Applies one set of configuration properties across
multiple profiles, nodes, cells, servers, or applications.
22
IBM Software Group
System administration for WebSphere Application Server V7: Part 4: Properties-based configuration
http://www.ibm.com/developerworks/websphere/techjournal/0904_chang/0904_chang.html
Creating server, cluster, application, or authorization group objects using properties files and wsadmin scripting
http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.nd.multiplatform.doc/info/ae/ae/txml_7propobjects.html
Deleting server, cluster, application, or authorization group objects using properties files
http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.nd.multiplatform.doc/info/ae/ae/txml_7delpropobjects.html
The WebSphere Contrarian: Changing host names and migrating profiles in WebSphere Application Server
http://www.ibm.com/developerworks/websphere/techjournal/0905_webcon/0905_webcon.html
23
IBM Software Group
24
IBM Software Group
25