Sun Java System Message Queue 4.1 Administration Guide

Clustering High-Availability Brokers

Because high-availability clusters are self-configuring, there is no need to explicitly specify the list of brokers to be included in the cluster. Instead, all that is needed is to set each broker’s configuration properties appropriately and then start the broker; as long as its properties are set properly, it will automatically be incorporated into the cluster. Table 8–1 shows the required settings. In addition, there may be vendor-specific settings required for a particular vendor’s database; Table 8–2 and Table 8–3 show these vendor-specific settings for Sun’s own HADB and MySQL from MySQLAB, respectively.

Table 8–1 Required Configuration Properties for HA Clusters

Property 

Required Value 

Description 

imq.cluster.ha

true

Broker is part of an HA cluster

imq.cluster.clusterid

 

Cluster identifier 

Must be the same for all brokers in the cluster.  

imq.brokerid

 

Broker identifier 

Must be different for each broker in the cluster 

imq.persist.store

jdbc

Model for persistent data storage 

Only JDBC-based persistence is supported for HA data stores.

imq.persist.jdbc.dbVendor

 

Database vendor for HA persistent store:

    hadb: HADB (Sun Microsystems, Inc.)


    derby: Java DB (Derby, Apache Software Foundation)


    oracle: Oracle Real Application Cluster (Oracle Corporation)


    mysql: MySQL (MySQL AB)


Table 8–2 Vendor-Specific Configuration Properties for HADB Database

Property 

Description 

imq.persist.jdbc.hadb.user

User name for opening database connection 

imq.persist.jdbc.hadb.password

Password for opening database connection 

imq.persist.hadb.property.serverList

JDBC URL of database

Use the command 

   hadbm get JdbcURL

to get the URL; remove the prefix

   jdbc:sun:hadb

and use  

   host:port,host:port...

for the property value.  

Table 8–3 Vendor-Specific Configuration Properties for MySQL Database

Property 

Description 

imq.persist.jdbc.mysql.user

User name for opening database connection 

imq.persist.jdbc.mysql.password

Password for opening database connection 

imq.persist.jdbc.mysql.property.url

JDBC URL for opening database

The property values can be set separately in each broker’s instance configuration file, or they can be specified in a cluster configuration file that all the brokers share. The procedures are as follows:

ProcedureTo Cluster HA Brokers Using Instance Configuration Files

  1. For each broker in the cluster:

    1. Start the broker with the imqbrokerd command.

      The first time a broker instance is run, an instance configuration file (config.properties) is automatically created.

    2. Shut down the broker.

      Use the imqcmd shutdown bkr command.

    3. Edit the instance configuration file to specify the broker’s HA-related configuration properties.

      Table 8–1 shows the required property values.

    4. Specify any additional, vendor-specific properties that may be needed.

      Table 8–2 and Table 8–3 show the required properties for HADB and MySQL databases, respectively.

  2. Place a copy of, or a symbolic link to, your JDBC driver’s .jar file in the appropriate location, depending on your platform:

      Solaris: /usr/share/lib/imq/ext/


      Linux: /opt/sun/mq/share/lib/


      Windows: IMQ_VARHOME\lib\ext


  3. Create the database schema needed for Message Queue persistence.

    Use the imqdbmgr create tbl command; see Database Manager Utility.

  4. Restart each broker with the imqbrokerd command.

    The brokers will automatically register themselves into the cluster on startup.

ProcedureTo Cluster HA Brokers Using a Cluster Configuration File

An alternative method, better suited for production systems, is to use a cluster configuration file to specify the composition of the cluster:

  1. Create a cluster configuration file specifying the cluster’s HA-related configuration properties.

    Table 8–1 shows the required property values. However, do not include the imq.brokerid property in the cluster configuration file; this must be specified separately for each individual broker in the cluster.

  2. Specify any additional, vendor-specific properties that may be needed.

    Table 8–2 and Table 8–3 show the required properties for HADB and MySQL databases, respectively.

  3. For each broker in the cluster:

    1. Start the broker with the imqbrokerd command.

      The first time a broker instance is run, an instance configuration file (config.properties) is automatically created.

    2. Shut down the broker.

      Use the imqcmd shutdown bkr command.

    3. Edit the instance configuration file to specify the location of the cluster configuration file.

      In the broker’s instance configuration file, set the imq.cluster.url property to point to the location of the cluster configuration file you created in step 1.

    4. Specify the broker identifier.

      Set the imq.brokerid property in the instance configuration file to the broker’s unique broker identifier. This value must be different for each broker.

  4. Place a copy of, or a symbolic link to, your JDBC driver’s .jar file in the appropriate location, depending on your platform:

      Solaris: /usr/share/lib/imq/ext/


      Linux: /opt/sun/mq/share/lib/


      Windows: IMQ_VARHOME\lib\ext


  5. Create the database schema needed for Message Queue persistence.

    Use the imqdbmgr create tbl command; see Database Manager Utility.

  6. Restart each broker with the imqbrokerd command.

    The brokers will automatically register themselves into the cluster on startup.