Changing the WebSphere Application Server configuration using wsadmin

Before you begin

For this task, the wsadmin scripting client must be connected to the deployment manager server.

Why and when to perform this task

You can use the wsadmin AdminConfig and AdminApp objects to make changes to the WebSphere Application Server configuration. The purpose of this article is to illustrate the relationship between the commands used to change the configuration and the files used to hold configuration data. This discussion assumes that you have a network deployment installation, but the concepts are very similar for a WebSphere Application Server installation.

Steps for this task

  1. Invoke the AdminConfig object commands interactively, in a script, or use the wsadmin -c commands from an operating system command prompt.
  2. Set a variable for creating a server:

    Using Jacl:

    set n1 [$AdminConfig getid /Node:mynode/]
    where:
    set is a Jacl command
    n1 is a variable name
    $ is a Jacl operator for substituting a variable name with its value
    AdminConfig is an object representing the WebSphere Application Server configuration
    getid is an AdminConfig command
    Node is the object type
    mynode is the name of the object that will be modified


  3. Create a server with the following command:

    Using Jacl:

    set serv1 [$AdminConfig create Server $n1 {{name myserv}}]
    where:
    set is a Jacl command
    serv1 is a variable name
    $ is a Jacl operator for substituting a variable name with its value
    AdminConfig is an object representing the WebSphere Application Server configuration
    create is an AdminConfig command
    Server is an AdminConfig object
    n1 evaluates to the ID of host node specified in step number 2
    name is an attribute
    myserv is the value of the name attribute


    After this command completes, some new files can be seen in a workspace used by the deployment manager server on behalf of this scripting client. A workspace is a temporary repository of configuration information that administrative clients use. Any changes made to the configuration by an administrative client are first made to this temporary workspace. For scripting, only when a save command is invoked on the AdminConfig object, these changes are transferred to the real configuration repository. Workspaces are kept in the wstemp subdirectory of a WebSphere Application Server installation.
  4. Make a configuration change to the server with the following command:

    Using Jacl:

    $AdminConfig modify $serv1 {{stateManagement {{initialState STOP}}}}
    where:
    $ is a Jacl operator for substituting a variable name with its value
    AdminConfig is an object representing the WebSphere Application Server configuration
    modify is an AdminConfig command
    serv1 evaluates to the ID of host node specified in step number 3
    stateManagement is an attribute
    initialState is a nested attribute within the stateManagement attribute
    STOP is the value of the initialState attribute


    This command changes the initial state of the new server. After this command completes, one of the files in the workspace is changed.
  5. Install an application on the server.
  6. Save the configuration changes with the following command:

    Using Jacl:

    $AdminConfig save
    Use the reset command of the AdminConfig object to undo changes that you made to your workspace since your last save.
  7. Set the variable for node synchronize.

    Note: This step only applies to network deployment installations.

    A node synchronization is necessary in order to propagate configuration changes to the affected node or nodes. By default this occurs periodically, as long as the node can communicate with the deployment manager. It is possible to cause this to happen explicitly by performing the following:

    You can perform this action across the entire cell to every active node agent at the same time.

    Using Jacl:

    set Sync1 [$AdminControl completeObjectName type=NodeSync,node=myNodeName,*]
    

    or

    set dmgr [$AdminControl completeObjectName type=DeploymentManager*]

    Example output:

    WebSphere:platform=common,cell=myNetwork,version=5.0,name=node
    Sync,mbeanIdentifier=nodeSync,type=NodeSync,node=myBaseNode,
    process=nodeagent
    

    or

    WebSphere:platform=common,cell=myNetwork,version=5.0,name=DeploymentManager,
    mbeanIdentifier=DeploymentManager,type=DeploymentManager,node=myManagerNode,
    process=dmgr

    where:
    set is a Jacl command
    Sync1 is a variable name
    $ is a Jacl operator for substituting a variable name with its value
    AdminControl is an object that enables the manipulation of MBeans running in a WebSphere server process
    completeObjectName is an AdminControl command
    type=NodeSync,node=myNodeName is a fragment of the object name whose complete name is returned by this command. It is used to find the matching object name which is, in this case, the SyncNode object for the node myNodeName, where myNodeName is the name of the node that you use to synchronize configuration changes. For example: type=Server, name=serv1. It can be any valid combination of domain and key properties. For example, type, name, cell, node, process, etc.


    type=DeploymentManager is a fragment of the object name whose complete name is returned by this command. It is used to find the matching object name which is, in this case, the SyncNode object for the node myNodeName, where myNodeName is the name of the node that you use to synchronize configuration changes. For example: type=Server, name=serv1. It can be any valid combination of domain and key properties. For example, type, name, cell, node, process, etc.


  8. Synchronize the node by issuing the following command:

    Note: This step only applies to network deployment installations.

    Using Jacl:

    $AdminControl invoke $Sync1 sync

    or

    $AdminControl invoke $dmgr syncActiveNodes

    Example output:

    true
    You will receive an output value of true if the synchronization completes.

    or

    {{node1 node2 node}}
    
    You will receive a list of nodes that are correctly synced.

    where:
    $ is a Jacl operator for substituting a variable name with its value
    AdminControl is an object that enables the manipulation of MBeans running in a WebSphere server process
    invoke is an AdminControl command
    Sync1 evaluates to the ID of the server specified in step number 7
    sync is an attribute of modify objects


    dmgr evaluates to the ID of the server specified in step number 7
    syncActiveNodes is an attribute of modify objects


    When the synchronization is complete, the files created in the c:/WebSphere/DeploymentManager/config/WebSphere/DeploymentManager/config directory now exist on the mynode node, in the c:/WebSphere/AppServer/config/WebSphere/AppServer/config directory.



Searchable topic ID:   txml_configchange
Last updated: Jun 21, 2007 9:56:50 PM CDT    WebSphere Application Server for z/OS, Version 5.0.2
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.websphere.zseries.doc/info/zseries/ae/txml_configchange.html

Library | Support | Terms of Use | Feedback