DevPortal

How do I Create topology.xml file?


To create a JMS Cluster you need to provide a topology.xml file to the NodeCreator as an argument. The topology.xml file contains information such as the node name, IP address, naming port, and HTTP port.

How do I Create Nodes in topology.xml?

Suppose you want to create two nodes with the following configuration in a JMS Cluster with the cluster name JMSCluster1:

Table 1: Creating Nodes in a JMS Cluster
NodeName IP Address Naming Port HTTP Port




jms1 localhost 9292 8282
jms2 localhost 9393 8383

The name of the cluster should be specified through the cluster name="JMSCluster1" type="JMS" tag with the type setting to JMS under the root element topology.

Multiple nodes can be specified in the topology.xml file through the node tag (under <topology> <cluster <create-nodes>) like the following:

<topology>
 <cluster name="JMSCluster1" type="JMS">
  <create-nodes>
   <node name="jms1" type="jms-cluster">
    <ip>localhost</ip>
    <naming-port>9292</naming-port>
    <http-port> 8282</http-port>
   </node>
   <node name="jms2" type="jms-cluster">
    <ip>localhost</ip>
    <naming-port>9393</naming-port>
    <http-port> 8383</http-port>
   </node>
  </create-nodes>
 </cluster>
</topology>

The type of the node must be jms-cluster as shown above.

What is Cluster Configuration Persistence?

The topology.xml file also contains cluster configuration persistence information for the cluster creation. The cluster configuration can be either file or db.

What is File Persistence?

Each cluster node reads the relevant configuration file from the localdisk (stored under nodes\<node-name>\config directory). In this case, if a change is required in one of the server configuration files, manual modification must be done in all the nodes. In these cases, the configuration of the nodes might not be in synch properly.

To configure the cluster configuration persistence to file type, add the following tag with the type as file under the <topology> <cluster> tag in the topology.xml file. <configuration-persistence type="file"> </configuration-persistence>

What is DB Persistence?

Each cluster node reads its configuration from a centralized database in which the configuration is stored. So, changing any configuration in the database is reflected in all the nodes.

To make configuration changes in db-based cluster configuration persistence, use the following steps:

  1. Change the server configuration in the configuration.xml in one of the nodes.
  2. Start the node with the -uploadconfig as command line argument. This uploads the localconfiguration into the centralized database.
  3. When any other node in the cluster is getting started, it downloads the configuration from the centralized database to its local configuration, so that all the nodes are in synch.

To configure the cluster configuration persistence to db type, you need to specify the Database Connection Details and the name of the table in which the cluster configuration should be stored.

A sample is given below with the type set to db.

<configuration-persistence type="db">
 <property name="driver" value="oracle.jdbc.driver.OracleDriver"/>
 <property name="url" value="jdbc:oracle:thin:@db:1521:db"/>
 <property name="user" value="scott"/>
 <property name="password" value="tiger"/>
 <property name="tablename" value="JMS_CLUSTER_PERSISTENCE"/>
</configuration-persistence>

In this case, if the given table JMS_CLUSTER_PERSISTENCE already exists in the given database, it throws an exception. If you want to drop the table, use the -force command as an argument to the command line to the node creator.

Now the topology.xml file looks like the following:

<?xml version="1.0" encoding="UTF-8"?>
<topology>
 <cluster name="JMSCluster1" type="JMS">
  <create-nodes>
   <node name="jms1" type="jms-cluster">
    <ip>localhost</ip>
    <naming-port>9292</naming-port>
    <http-port> 8282</http-port>
   </node>
    <node name="jms2" type="jms-cluster">
    <ip>localhost</ip>
    <naming-port>9393</naming-port>
    <http-port>8383</http-port>
   </node>
  </create-nodes>
  <configuration-persistence type="db">
   <property name="driver" value="oracle.jdbc.driver.OracleDriver"/>
   <property name="url" value="jdbc:oracle:thin:@db:1521:db"/>
   <property name="user" value="scott"/>
   <property name="password" value="tiger"/>
   <property name="tablename" value="JMS_CLUSTER_PERSISTENCE"/>
  </configuration-persistence>
 </cluster>
</topology>


Related Topics:

© Pramati Technologies 2007 Runs on Pramati Server | Feedback | Legal