Sun Java System Application Server Enterprise Edition 8.1 2005Q2 High Availability Administration Guide

- Previous: Connection Pooling and Failover
- Next: Chapter 10 RMI-IIOP Load Balancing and Failover

## To Enable MQ clusters with Application Server Clusters

1. Create an Application Server cluster, if one does not already exist.

   For information on creating clusters, see To Create a Cluster.

2. Create an MQ broker cluster.

   First, delete the default JMS host that refers to the broker started by the Domain Administration Server, and then create three external brokers (JMS hosts) that will be in the MQ broker cluster.

   Create a JMS hosts with either the Admin Console or the `asadmin` command-line utility.

   To use `asadmin`, the commands are for example:

       asadmin delete-jms-host --target cluster1 default_JMS_host
       asadmin create-jms-host --target cluster1
            --mqhost myhost1 --mqport 6769
            --mquser admin --mqpassword admin broker1
       asadmin create-jms-host --target cluster1
            --mqhost myhost2 --mqport 6770
            --mquser admin --mqpassword admin broker2
       asadmin create-jms-host --target cluster1
            --mqhost myhost3 --mqport 6771
            --mquser admin --mqpassword admin broker3

   To create the hosts with Admin Console:

   1. Navigate to the JMS Hosts node (Configurations > config-name > Java Message Service > JMS Hosts)

   2. Delete the default broker (default_JMS_host).

      Select the checkbox next to it, and then click Delete.

   3. Click New to create each JMS host and enter its property values.

      Fill in the values for host name, DNS name or IP address, port number, administrative user name and password.

3. Start the master MQ broker and the other MQ brokers.

   In addition to the three external brokers started on JMS host machines, start one master broker on any machine. This master broker need not be part of a broker cluster. For example:

       /usr/bin/imqbrokerd -tty -name brokerm -port 6772
        -cluster myhost1:6769,myhost2:6770,myhost2:6772,myhost3:6771
        -D"imq.cluster.masterbroker=myhost2:6772"

4. Start the Application Server instances in the cluster.

5. Create JMS resources on the cluster:

   1. Create JMS physical destinations.

      For example, using `asadmin`:

          asadmin create-jmsdest --desttype queue --target cluster1 MyQueue
          asadmin create-jmsdest --desttype queue --target cluster1 MyQueue1

      To use Admin Console:

      1. Navigate to the JMS Hosts page (Configurations > config-name > Java Message Service > Physical Destinations).

      2. Click New to create each JMS physical destination.

      3. For each destination, enter its name and type (queue).

   2. Create JMS connection factories.

      For example, using `asadmin`:

          asadmin create-jms-resource --target cluster1
          --restype javax.jms.QueueConnectionFactory jms/MyQcf
          asadmin create-jms-resource --target cluster1
          --restype javax.jms.QueueConnectionFactory jms/MyQcf1

      To use Admin Console:

      1. Navigate to the JMS Connection Factories page (Resources > JMS Resources > Connection Factories).

      2. To create each connection factory, click New.

         The Create JMS Connection Factory page opens.

      3. For each connection factory, enter JNDI Name (for example `jms/MyQcf`) and Type, `javax.jms.QueueConnectionFactory`

      4. Select the cluster from the list of available targets at the bottom of the page and click Add.

      5. Click OK to create the connection factory.

   3. Create JMS destination resources.

      For example, using `asadmin`:

          asadmin create-jms-resource --target cluster1
               --restype javax.jms.Queue
               --property imqDestinationName=MyQueue jms/MyQueue
          asadmin create-jms-resource --target cluster1
               --restype javax.jms.Queue
               --property imqDestinationName=MyQueue1 jms/MyQueue1

      To use Admin Console:

      1. Navigate to the JMS Destination Resources page (Resources > JMS Resources > Connection Factories).

      2. To create each destination resource, click New.

         The Create JMS Destination Resource page opens.

      3. For each destination resource, enter JNDI Name (for example `jms/MyQueue`) and Type `javax.jms.Queue`.

      4. Select the cluster from the list of available targets at the bottom of the page and click Add.

      5. Click OK to create the destination resource.

6. Deploy the applications with the `– retrieve` option for application clients. For example:

       asadmin deploy --target cluster1
       --retrieve /opt/work/MQapp/mdb-simple3.ear

7. Access the application and test it to ensure it is behaving as expected.

8. If you want to return the Application Server to its default JMS configuration, delete the JMS hosts you created and recreate the default. For example:

       asadmin delete-jms-host --target cluster1 broker1
       asadmin delete-jms-host --target cluster1 broker2
       asadmin delete-jms-host --target cluster1 broker3
       asadmin create-jms-host --target cluster1
        --mqhost myhost1 --mqport 7676
        --mquser admin --mqpassword admin
        default_JMS_host

   You can also perform the equivalent operation with Admin Console.

##### Troubleshooting

If you encounter problems, consider the following:

- View the Application Server log file. If you see in the log file that an MQ broker does not respond to a message, stop the broker and then restart it.

- Always be sure to start MQ brokers first, then Application Server instances.

- When all MQ brokers are down, it takes 30 minutes for Application Server to go down or up, with the default values in Java Message Service. Tune Java Message Service values to get acceptable values for this timeout. For example:

      asadmin set --user admin --password administrator
      cluster1.jms-service.reconnect-interval-in-seconds=5

- Previous: Connection Pooling and Failover
- Next: Chapter 10 RMI-IIOP Load Balancing and Failover

- © 2010, Oracle Corporation and/or its affiliates