Tech Tip #25 showed how to configure WildFly on Raspberry Pi. This tech tip will show how to setup a WildFly managed domain over two hosts running on Raspberry Pi. Lets understand some basic concepts first. WildFly can run in two modes: 
  • Managed Domain allows you to run and manage a multi-server domain topology
  • Standalone allows to run a single instance of server
Multiple standalone instances can be configured to form a highly available cluster. It is up to the user to coordinate management across multiple servers though. Servers running in managed domain mode are referred to as the members of a "domain". A singleDomain Controller acts as the central management control point for the domain. A domain can span multiple physical or virtual hosts, with all WildFly instances on a given host under the control of a Host Controller process. One Host Controller instance is configured to act as the Domain Controller. The Host Controller on each host interacts with the Domain Controller to control the lifecycle of the application server instances running on its host and to assist the Domain Controller in managing them. It is important to understand that administration of servers (standalone or managed domain) is orthogonal to clustering and high availability. In the managed domain mode, a server instance always belong to a Server Group. A domain can have multiple Server Groups. Each group can be configured with different profiles and deployments. wildfly-clustering-architecture-techtip27 For example, default WildFly installation comes with "main-server-group" and "other-server-group" as shown: 
  <server name="server-one" group="main-server-group" auto-start="false"/>
  <server name="server-two" group="main-server-group" auto-start="false">
    <socket-bindings port-offset="150"/>
  <server name="server-three" group="other-server-group" auto-start="true">
    <socket-bindings port-offset="250"/>
"main-server-group" has two servers: "server-one" and "server-two". "other-server-group" has one server: "server-three". default-server-group-techtip27 By default, these are all configured on a single machine (localhost) with Host Controller and Domain Controller co-located. This is defined in "domain/configuration/host.xml". Each Server Group is configured with a profile. These profiles are defined, and associated with a Server Group, in "domain/configuration/domain.xml". Default WildFly installation comes with two profiles: "full" and "full-ha". 
  <server-group name="main-server-group" profile="full">
    . . .
  <server-group name="other-server-group" profile="full-ha">
    . . .
"main-server-group" is configured with "full" profile and "other-server-group" is configured with "full-ha" profile. server-group-profiles-techtip27 Profile is a named set of subsystem configurations that adds capabilities like Servlet, EJB, JPA, JTA, etc. The "full-ha" profile also enable all subsystems needed to establish cluster (infinispan, jcluster, and mod_cluster). OK, enough explanation, lets get into action! Make sure to install WildFly on each of the Raspberry Pi following Tech Tip #25.