Introduction
Nirvana provides the ability to group Realm servers
together to form a cluster. A cluster is a logical group
of realm servers that share common channels and queues.
The channels and queues and any operations performed
on then are replicated across all cluster members. Clients
connecting to 'Realm A' in cluster 1, are able to access
the same logical objects as clients connecting to Realms
B or C in cluster1.
The state of these objects is fully replicated by each
realm in the cluster. For example, if you create a queue
(queue1) within cluster 1, it is physically created
in realms A, B and C. If there are 3 consumers on queue1,
say one on each of realms A, B and C respectively, each
realm in the cluster will be aware as each message is
consumed and removed from the different physical queue1
objects in the 3 realms.
If one of the realms within cluster1 stops, due to
a hardware or network problems, then clients can automatically
reconnect to any of the other realms and start from
the same point in time on any of the other realms in
the cluster.
This ensures a number of things:
Transparency - Any
client can connect to any Nirvana realm server within
a cluster and see the same cluster objects with the
same state. Clients disconnected from one realm will
automatically be reconnected to another cluster realm.
24 x 7 Availability - If one server
stops, the other realms within the cluster will take
over the work, providing an always on service
Scalability - Large number
of client connections can be managed across multiple
servers within a cluster
nClusterNode
Using the nAdmin API, if you wish to create a cluster
that contains 3 realms, and you know the RNAME
values for all 3, then the following call will create
the cluster.
String[] RNAME=({“nsp://127.0.0.1:9000”,
"nsp://127.0.0.1:10000","nsp://127.0.0.1:11000
});
nRealmNode realms[] = new nRealmNode[RNAME.length];
nClusterMemberConfiguration[] config = new nClusterMemberConfiguration[RNAME.length];
for (int x = 0; x < RNAME.length; x++) {
// you don;t have to create the realm nodes
here, since the member configuration will create
them for you form the RNAME values
realms[x] = new nRealmNode(new nSessionAttribute(RNAME[x]));
config[x]=new nClusterMemberConfiguration(realms[x],
true);
}
nClusterNode cluster = nClusterNode.create("cluster1",
config);
Once the cluster node is created, each realm node within
the cluster will know of the other realms within the
cluster, and be aware of the cluster they are part of.
For example, calling the following method:
nClusterNode cluster = realms[0].getCluster();
will return the cluster node just created with the
realm with nsp://127.0.0.1:9000 for an RNAME.
Cluster nodes contain information about the member
realms (nRealmNode objects) as well as the current state
of the cluster members. This information can be found
by calling the getClusterConnectionStatus() method
on the cluster node, which returns a vector of nClusterStatus
objects, each of which correspond to a
realm.
nRealmlNode
Once a realm becomes part of a cluster, channels and
queues can be created that are part of the cluster,
as well as standard local channels and queues within
the realms. For example, if you were to us the following
calls:
nChannelAttributes cattrib = new nChannelAttributes();
cattrib.setMaxEvents(0);
cattrib.setTTL(0);
cattrib.setType(nChannelAttributes.PERSISTENT_TYPE);
cattrib.setClusterWide(true);
cattrib.setName(“clusterchannel”);
nLeafNode=.createChannel(cattrib);
realms[0].createChannel(cattrib);
This would create a channel that is visible to all
realms within a cluster. Any administrative changes
made to this channel such as ACL
modifications will also be propogated to all cluster
members in order for the channel to be kept in sync
across all realms.
For more information on the Nirvana Administration,
please see the API
documentation, and the administrator
guide.
|