Running in Enterprise Mode Using the Command Line

In enterprise mode, bwagents can communicate across machines and can be configured to form a bwagent network.

This procedure shows you how to set up a network using bwagents on two machines and use bwadmin to create runtime entities across machines.

Enterprise mode requires a data persistence and communication transport layer to keep bwagents in sync across machines. By default, TIBCO FTL® is used for communication transport and external database for data persistence. The software also provides the option of using TIBCO Enterprise Message Service (EMS) for communication transport.

For more information about configuring bwagent, see Configuring bwagent .

The following example uses TIBCO FTL®, the default configuration.

Prerequisites

Install the software on two machines. Machines are noted as M1 and M2 in the instructions. Make a note of the host name or IP address for each machine.

Procedure

  1. Configure the bwagent on machine M1.
    For more information about how to configure bwagent with database TIBCO FTL®, see Database with TIBCO FTL®
  2. Repeat the configuration for the bwagent on machine M2.
    Ensure that same database, TIBCO FTL® and network name is used for M1 and M2.
  3. Start the bwagent on M1.
    1. Open a terminal on M1 and navigate to the BW_HOME\bin folder (Windows) or [root@BW_HOME bin]# (Unix).
    2. Type bwagent (Windows) or ./bwagent (Unix).
      The bwagent starts.
  4. Start the bwagent on M2.
    1. Open a terminal on M2 and navigate to BW_HOME\bin folder (Windows) or ${BW_HOME}/bin (Unix).
    2. Type bwagent (Windows) or ./bwagent (Unix).
      The bwagent starts.
  5. Start the bwadmin console on M1 machine and show the bwagents.
    • Windows:
      BW_HOME\bin>bwadmin show agents
    • Unix:
      [root@BW_HOME bin]# ./bwadmin show agents
    The TEA Server URL, Registered TEA Agent, and Auto Registration settings are important when you are using the Admin UI. These settings can be ignored for this example. For more information about the Admin UI, see Running Applications in Enterprise Mode using the Admin UI and Using the Admin UI.
  6. Now the bwagents on machines M1 and M2 are communicating with each other. You can use the bwadmin console on M1 to create a domain on M2 by specifying the bwagent in the command line.
    • Windows:
      BW_HOME\bin>bwadmin create -agent M2 domain D1M2
    • Unix:
      [root@BW_HOME bin]# ./bwadmin create -agent M2 domain D1M2
  7. On M1, use the show domains command to show the domain.
    • Windows:
      BW_HOME\bin>bwadmin show domains
    • Unix:
      [root@BW_HOME bin]# ./bwadmin show domains
  8. Create an AppSpace on M2 using bwadmin on M1.
    1. Create an AppSpace on M2 by specifying the bwagent. Two AppNodes are specified. The -minNodes option specifies the number of nodes in the AppSpace. The AppSpace cannot be started until this value is met. For more information about AppSpaces and AppNodes, see the Administration Concepts topic in the TIBCO ActiveMatrix BusinessWorks™ Concepts guide.
      • Windows:
        BW_HOME\bin>bwadmin create -agent M2 -domain D1M2 -minNodes 2 appspace AS1M2
      • Unix:
        [root@BW_HOME bin]# ./bwadmin create -agent M2 -domain D1M2 -minNodes 2 appspace AS1M2
    2. View the file system on machine M2 to verify that the AppSpace was created. The example below shows the file system on a Windows machine.

      Each runtime entity is created in the file system. It is critical that all runtime entities are managed using bwadmin so that they are in sync with the datastore.

  9. On machine M1, create the 2 AppNodes for the AppSpace AS1M2, specifying bwagent M2 for the AppNodes. The HTTP management port must be unique. A list of defined AppNodes for a given domain, including port numbers, is available with the show command: show -d <DomainName> appnodes
    Note: When an AppNode is created, an optional port for the OSGi console can be specified to monitor the AppNode (Only enable this port for troubleshooting purposes.). For more information, see Enabling the OSGi Console for an AppNode.

    Windows:

    BW_HOME\bin>bwadmin create -agent M2 -domain D1M2 
    -appspace AS1M2 -httpPort 8070 appnode AN1M2
    BW_HOME\bin>bwadmin create -agent M2 -domain D1M2 
    -appspace AS1M2  -httpPort 8071 appnode AN2M2

    Unix:

    [root@BW_HOME bin]# ./bwadmin create -agent M2 -domain D1M2 
    -appspace AS1M2 -httpPort 8070 appnode AN1M2
    [root@BW_HOME bin]# ./bwadmin create -agent M2 -domain D1M2 
    -appspace AS1M2  -httpPort 8071 appnode AN2M2

    The -httpPort option is case sensitive.

  10. From the bwadmin console on M1, upload an application archive into the domain on M2.

    Windows:

    BW_HOME\bin>bwadmin upload -domain D1M2 ../samples/core/admin/ears/bookstore/tibco.bw.sample.binding.rest.BookStore.application_1.0.0.ear
    

    Unix:

    [root@BW_HOME bin]# ./bwadmin upload -domain D1M2 ../samples/core/admin/ears/bookstore/tibco.bw.sample.binding.rest.BookStore.application_1.0.0.ear
    
  11. From M1, start the AppSpace on M2. This starts the AppNodes in the AppSpace on M2.

    Windows:

    BW_HOME\bin>bwadmin start -domain D1M2 appspace AS1M2
    

    Unix:

    [root@BW_HOME bin]# ./bwadmin start -domain D1M2 appspace AS1M2
    
  12. From the bwadmin console on M1, verify that the AppNodes are running:

    Windows:

    BW_HOME\bin>bwadmin show -domain D1M2 -appspace AS1M2 appnodes
    

    Unix:

    [root@BW_HOME bin]# ./bwadmin show -domain D1M2 -appspace AS1M2 appnodes
    
  13. Use bwadmin on M1 to stop the AppSpace on M2. This will stop AppNodes AN1M2 and AN2M2.

    Windows:

    BW_HOME\bin>bwadmin stop -domain D1M2 appspace AS1M2
    

    Unix:

    [root@BW_HOME bin]# ./bwadmin stop -domain D1M2 appspace AS1M2
    
  14. Back up the domain. The backup command exports the persisted state of runtime entities into a command file. This command file can be used to recreate the environment. For more information, see Backing Up and Restoring from the Backup.
    The backup command requires the name of the specific entity being backed up (domain, agent, AppSpace or AppNode) as well as the path to a destination file. In this example (Windows), D1M2 is backed up.
    BW_HOME\bin>bwadmin backup -s backup.cmd domain D1M2
    
    Note: The bwadmin backup command and the bwadmin restore command are not complimentary. The backup command exports the current state of the environment to a command file. The restore command restores the file system of a bwagent to the state of the persistent datastore. For more information, see Backing Up and Restoring from the Backup and Restoring the File System of Runtime Entities.

Result

You set up a network with two bwagents on two machines. You used the bwadmin console on one machine to create runtime entities on the other machine. You uploaded an application archive to the domain and started the AppSpace. You also backed up the environment.

You can continue experimenting by adding additional machines to the network, adding more runtime entities, or deploying the archive (you will need to start the AppSpace again).

When you are done, you can force delete the domain using bwadmin on either machine with the following bwadmin command: delete -force domain D1M2

After you delete the domain, you can recreate the environment from the backup by feeding the backup command file to bwadmin, for example: bwadmin -f backup.cmd (Windows).

To exit the bwagent, type ^C (this may take a few seconds). At the command line, type bwagent stop to completely stop the agent.