![]() |
|
The cluster definition is essentially defined along with the first cluster node, and the same common persistence information and cluster details should be setup in all the other nodes that form a part of this cluster.
The steps involved in creating a cluster are:
server-config.xml file and add a declaration as <belongs-to-cluster> MyCluster </belongs-to-cluster>.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 that 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.
server-config.xml under configuration-persistence tag as shown in the code snippet below. By default, all the configuration information is 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 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 sync-up. The new version of Server supports an 'On Demand sync-up', wherein the configuration information for each node is synchronized with every other node and persisted in the DB.
Setup the cluster configuration file that would define all nodes that form part of this cluster. The cluster-config.xml captures information on the nodes that forms a cluster. Initially, when creating the cluster, this information is to be provided in this file.
Note: This file will be identical in ALL the nodes that will form the cluster - with information on each one of them.
After the first startup of the Server, the information gets persisted in the DB/File persistence store of the cluster. A read-only version of the file is always available synched up from the DB, on each start of the cluster node.
To create a cluster by manually editing the cluster-config.xml:
cluster-config.xml file from the templates directory to the nodes\<node-name>\config directory.
<node>
<name>N1</name>
<computer-name>128.128.77.77</computer-name>
<naming-port>9191</naming-port>
<http-port>8181</http-port>
<node-type>BOTH</node-type>
<node-id>001</node-id>
</node>
<node>
<name> N2 </name>
<computer-name> 128.128.77.78 </computer-name>
<naming-port> 9190 </naming-port>
<http-port> 8180 </http-port>
<node-type> BOTH </node-type>
<node-id> 002 </node-id>
</node>
Related Topics:
| © Pramati Technologies 2007 | Runs on Pramati Server | Feedback | Legal |