A configuration can be deployed to a cluster of Geronimo servers by using a single logical deployment step. After a configuration is deployed to a cluster, this configuration can be transparently started, stopped, or undeployed across all the cluster members.
These two features greatly streamline the maintenance of applications that are running on a cluster because Geronimo takes care of cluster-wide application distribution and management for you.
Configuration of Cluster Members
- A specific name should be given to your Geronimo instance. This can be achieved by updating the
clusterNodeNameproperty defined within
- Cluster members are configured on a Geronimo server, which can, but is not required to, be a member of the cluster. This is achieved by adding a org.apache.geronimo.farm.config.BasicNodeInfo GBean for each cluster member to the farming configuration of
config.xml. This GBean looks like this: It defines the network address (host, port, urlPath) and the credentials (username and password) to be used to connect to the cluster member via JMX. Such declarations are to be included within the
config.xmlfile, farming module of your Geronimo server.
By default, the farming configuration defines the local server as a cluster member. To exclude it, you can prevent the GBean NodeInfo to start.
To deploy a configuration to configure members, you simply deploy it to the MasterConfigurationStore repository defined by the farming configuration. This configuration being stopped out-of-the-box, you might have to start it the first time by using this GShell command:
farming adds two new repositories to the server: MasterConfigurationStore and ClusterStore. MasterConfigurationStore is the repository you should use most of the time if not always. ClusterStore is a repository you might have to use in specific and infrequent scenarios.
To deploy to MasterConfigurationStore, pass the --targets flag to the distribute or deploy commands like this:
Following this deployment,
- MasterConfigurationStore contains a kind of virtual configuration under an altered name, a '_G_MASTER' is appended to the configuration name, and
- ClusterStore contains the actual configuration that has the same name as your deployment and defines GBeans controlling the remote start and stop of the actual configuration cluster-wide;
Cluster-wide Management of Configurations
To undeploy across the farm, users need to execute the undeploy command on the same node that they used to deploy/distribute their application across the farm. Note that this node acts as a kind of Administration Server, whereby it is the only node whose farming configuration needs to be maintained to reflect farm members and any lifecycle operations against farmed modules (e.g. start/stop) are propagated to the other nodes. To start, stop, or undeploy configurations across a cluster, perform the relevant deployment task against the virtual configuration.
All the cluster members configured at the time of the initial deployment must be running. Otherwise, these operations are partially executed. For instance, if three members were configured and only two of them are running when the virtual configuration is undeployed, then the configuration is removed from the ClusterStore of the two running servers. The ClusterStore of the third server still contains the configuration and will have to be manually undeployed on this server.