Installation guide
91
CHAPTER 20
Creating Pramati Server Clusters Using XMLs
2 Define the name of the cluster. Open the server-config.xml file and add a declaration as
follows:
<belongs-to-cluster> MyCluster </belongs-to-cluster>
3 Enable the cluster service. This cluster name is a logical representation for a group of nodes
enabling them to communicate with each other. Once the node is identified as part of a cluster,
the service definition for the cluster can be added in the
server-config.xml file as follows:
<service name="ClusterService" enabled="true"
class-name="com.pramati.cluster.PramatiClusterService">
<config-file>cluster-config.xml</config-file>
<requires always="NamingService" />
</service>
Set the 'enabled' attribute to true, so the cluster service is started when the services framework is
started. As you can infer from the above code snippet, the actual configuration file for the cluster
is stored by every node in
cluster-config.xml.
Note: Though at present the nodes interact with each other through a repository of IP and port
information, it is important that the nodes identify themselves with a common name.
4 Setup persistence. The services configuration in a node can be stored either in a file or a database.
The information can be specified in
server-config.xml under <configuration-
persistence> tag as shown in the code snippet below. By default all the configuration
information are persisted to the file.
<configuration-persistence use="file">
<persistence type="file" />
<persistence type="db">
<property name="driver" value="" />
<property name="url" value="" />
<property name="user" value="" />
<property name="password" value="" />
<property name="tablename" value="" />
</persistence>
</configuration-persistence>
Persistence can be configured either at the file level or DB level. For DB level persistence, connection
parameters like driver, connection URL, username, password and table name can be specified in the
configuration file, which are persisted. A driver can be any valid JDBC driver and varies for different
databases. The 'tablename' attribute is used to create a specific table where the configuration details
for all the services are stored.
If you are setting up a new cluster, you can opt for a file level persistence, where the DB is not used
for aiding a synch-up. The new version of Server supports an 'On Demand sync up', wherein the
configuration information for each node are synched up with every other node and persisted in the
DB.