This section describes how to configure JOnAS to run the following architecture:
CMI is a new ORB used by JOnAS to provide clustering for load balancing and high availability. Several instances of JOnAS can be started together in a cluster to share their EJBs. It is possible to start the same EJB on each JOnAS, or to distribute their load. A URL referencing several JOnAS instances can be provided to the clients. At lookup time, a client randomly chooses one of the available servers to request the required bean. Each JOnAS instance has the knowledge (through JavaGroups) of the distribution of the beans in the cluster. An answer to a lookup is a special clustered stub, containing stubs to each instance known in the cluster. Each method call on the home of the bean can be issued by the stub to a new instance, to balance the load on the cluster. The default algorithm used for load distribution is currently a weighted round-robin.
In the build.properties of the application, set the protocol name to cmi before compilation:
protocols.names=cmi |
In the file carol.properties of the directory $JONAS_BASE/conf), set the protocol to cmi:
carol.protocols=cmi |
In the file carol.properties, configure the multicast address, the group name, the round-robin weighted factor, etc. For example:
# java.naming.provider.url property carol.cmi.url=cmi://localhost:2002 # Multicast address used by the registries in the cluster carol.cmi.multicast.address=224.0.0.35:35467 # Groupname for JavaGroups carol.cmi.multicast.groupname=G1 # Factor used for this server in weighted round robin algorithms carol.cmi.rr.factor=100 |
For the client, specify the list of registries available in the carol.properties file:
carol.cmi.url=cmi://server1:port1[,server2:port2...] |
Notes: | |
---|---|
The multicast address and group name must be the same for all JOnAS servers in the cluster. If Tomcat Replication associated to cmi is used, the multicast addresses of the two configurations must be different. |