The easiest way to deploy an application into the cluster is to use the farming service. Using the farming service, you can deploy an application (EAR, WAR, or SAR; either an archive file or in exploded form) to the
production/farm/ directory of any cluster member and the application will be automatically duplicated across all nodes in the same cluster. If a node joins the cluster later, it will pull in all farm deployed applications in the cluster and deploy them locally at start-up time. If you delete the application from a running clustered server node's farm/ directory, the application will be undeployed locally and then removed from all other clustered server nodes' farm/ directories (triggering undeployment).
Farming is enabled by default in the
production configuration in JBoss Enterprise Web Platform and thus requires no manual setup. The required farm-deployment-jboss-beans.xml and timestamps-jboss-beans.xml configuration files are located in the deploy/cluster directory. If you want to enable farming in a custom configuration, simply copy these files to the corresponding JBoss deploy directory: $JBOSS_HOME/server/$CUSTOM_CONFIG/deploy/cluster. Make sure that your custom configuration has clustering enabled.
While there is little need to customize the farming service, it can be customized via the
FarmProfileRepositoryClusteringHandler bean, whose properties and default values are listed below:
<bean name="FarmProfileRepositoryClusteringHandler"
class="org.jboss.profileservice.cluster.repository.
DefaultRepositoryClusteringHandler">
<property name="partition"><inject bean="HAPartition"/></property>
<property name="profileDomain">default</property>
<property name="profileServer">default</property>
<property name="profileName">farm</property>
<property name="immutable">false</property>
<property name="lockTimeout">60000</property><!-- 1 minute -->
<property name="methodCallTimeout">60000</property><!-- 1 minute -->
<property name="synchronizationPolicy"><inject bean="FarmProfileSynchronizationPolicy"/></property>
</bean>
-
partition - Required to inject the
HAPartitionservice that the farm service uses for intra-cluster communication. profileDomain,profileServer,profileName- Used to identify the profile for which this handler is intended.
-
immutable - Indicates whether this handler allows a node to push content changes to the cluster. A value of
trueis equivalent to settingsynchronizationPolicytoorg.jboss.system.server.profileservice.repository.clustered.sync.ImmutableSynchronizationPolicy. -
lockTimeout - Defines the number of milliseconds to wait for cluster-wide lock acquisition.
-
methodCallTimeout - Defines the number of milliseconds to wait for invocations on remote cluster nodes.
-
synchronizationPolicy - Determines how to handle content addition, reincarnation, updates and removals from nodes attempting to join the cluster or from cluster merges. The policy is consulted on the authoritative node (the master node for the service on the cluster). Reincarnation describes a situation where a newly started node may contain an application starting node in its
farmdirectory that was previously removed by the farming service, but may still exist on the starting node if it was not running when the removal took place.The default synchronization policy is defined as follows:<bean name="FarmProfileSynchronizationPolicy" class="org.jboss.profileservice.cluster.repository. DefaultSynchronizationPolicy"> <property name="allowJoinAdditions"><null/></property> <property name="allowJoinReincarnations"><null/></property> <property name="allowJoinUpdates"><null/></property> <property name="allowJoinRemovals"><null/></property> <property name="allowMergeAdditions"><null/></property> <property name="allowMergeReincarnations"><null/></property> <property name="allowMergeUpdates"><null/></property> <property name="allowMergeRemovals"><null/></property> <property name="developerMode">false</property> <property name="removalTrackingTime">2592000000</property><!-- 30 days --> <property name="timestampService"><inject bean="TimestampDiscrepancyService"/></property> </bean>allow[Join|Merge][Additions|Reincarnations|Updates|Removals]define fixed responses to requests to allow additions, reincarnations, updates, or removals from joined or merged nodes.developerModeenables a lenient synchronization policy that allows all changes. Enabling developer mode is equivalent to setting each of the above properties totrueand is intended for development environments.removalTrackingTimedefines the number of milliseconds for which this policy should remembered removed items, for use in detecting reincarnations.timestampServiceestimates and tracks discrepancies in system clocks for current and past members of the cluster. Default implementation is defined intimestamps-jboss-beans.xml.