Skip to end of metadata
Go to start of metadata

This article will help you (practically, step-by-step) in creating a domain controller instance with two EAP 6.4 instances installed with SwitchYard along with a load balancer. It creates two instances of a cluster a master and slave. Fronted by mod_cluster as the load balancer, it demonstrates a sample SwitchYard application from the quickstarts. For this we will need two machines where each will be running its own SwitchYard instance. There are ways to create virtual network adapters and run two instances in the same machine. Some Googling will give you an idea. Assume we have a subnet of 192.168.1. and two network adapters bound to the following ips

For the lazy folks I have included my files as attachment. We will start by setting up the load balancer in the master machine.

Assumption
  1. You have installed JDK 1.6 or higher.
  2. You already have setup SwitchYard server (with EAP 6.4) on both the machines and tested it to your utmost satisfaction.

Load Balancer

  • Download mod_cluster. I used version 1.3.1.Final with no ssl.
  • Extract the contents in a safe place say /home/user/tools/httpd2.4
  • Copy httpd2.4/conf/default/httpd.conf.in to httpd2.4/conf/httpd.conf
  • Edit the contents in sequence as shown below:
    Notice the file path had an underscore.

    Now start the httpd service or daemon. If all went well, then it should start clean with no errors.
    Access the page

    http://192.168.1.80:10001/mod_cluster-manager
    

    You should see the cluster information like this:

    Shutdown the load balancer.

    SwitchYard instances

    Domain Controller - Master

  • Create Managament users admin and slave under ManagementRealm
  • Edit domain.xml as follows:
  • Edit host.xml as follows:

    Slave

  • Create Managament user slave under ManagementRealm
  • Edit host.xml

    Test

    Start the domain controller:

    domain -b 192.168.1.80 -bmanagement 192.168.1.80
    

    Wait for the master to finish starting up. Now start the slave:

    domain -b 192.168.1.81 -bmanagement 192.168.1.81
    

    You should see the following output in the master instance

    This proves that the our setup works. Shutdown the instances. Edit domain.xml of master instance.

  • Add "proxy-list" (MCMP) server to mod-cluster-config
    <mod-cluster-config advertise-socket="modcluster" connector="ajp" proxy-list="192.168.1.80:10001">
    Notice this points to our load balancer.
    Start the servers one by one.
    httpd
    master
    slave
    
    Cluster Demo

    Navigate to EAP home quickstarts/switchyard/demos/cluster and build the credit and dealer applications

    cd credit
    mvn install
    cd ../dealer
    mvn install
    
  • Visit the Management console of the cluster via the domain controllers URL:
    http://192.168.1.80:9990
  • Click on Runtime and topology should look like this:
  • Click on Manage Deployments, click Add and add the following deployments
    quickstarts/switchyard/demos/cluster/credit/target/switchyard-demo-cluster-credit.jar
    quickstarts/switchyard/demos/cluster/dealer/target/switchyard-demo-cluster-dealer.jar
    
  • Your content repository now should look like this:
  • Assign the deployments and activate it to the main-server-group. The main-server-group should look like this and the deployments should be active:
    Testing cluster demo app
  • Now navigate to folder quickstarts/switchyard/demos/cluster/client and modify the RemoteClient.java test file. Edit the URL to point to the load balancer's ip address and port.
  • Build the application and execute the test client
    mvn install
    mvn exec:java
    

    You should see the following output

    ==================================
    Was the offer accepted? true
    ==================================
    

    And in one of the instances of our cluster.

    INFO  [Credit Service] (http-/192.168.1.80:8080-1) Credit Service : Approving credit for John Smith
    

    Experiment with more requests hitting the load balancer and notice they being distributed among the master and slave instances.
    That brings to the end of this tutorial. You can read further the Reference materials and complicate things using many servers in the cluster and/or server-group. Have fun!

    The path is never easy

    Here are some of the errors that you may encounter.

    Already registered name
    WARN [org.jboss.as.host.controller] (Controller Boot Thread) JBAS010900: Could not connect to remote domain controller at remote://192.168.1.80:9999 – 2-$-JBAS010832: There is already a registered host named 'master'
    WARN [org.jboss.as.host.controller] (Controller Boot Thread) JBAS016581: No domain controller discovery options remain.
    ERROR [org.jboss.as.host.controller] (Controller Boot Thread) JBAS010901: Could not connect to master. Aborting. Error was: java.lang.IllegalStateException: JBAS016519: Tried all domain controller discovery option(s) but unable to connect

    You forgot to change the host name in slave's host.xml

    Indirect dependencies missing
    ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014612: Operation ("add") failed - address: ([
    ("subsystem" => "infinispan"),
    ("cache-container" => "switchyard"),
    ("replicated-cache" => "default")
    • failure description: {"JBAS014879: One or more services were unable to start due to one or more indirect dependencies not being available." => {
      "Services that were unable to start:" => ["jboss.infinispan.switchyard.default"],
      "Services that may be the cause:" => ["jboss.jgroups.stack"]
      }}
      INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
      JBAS014775: New missing/unsatisfied dependencies:
      service jboss.jgroups.stack (missing) dependents: [service jboss.jgroups.channel.switchyard, service jboss.infinispan.switchyard.config]

    In this example, you are starting/using servers without jgroups. So you are not using the full-ha profile. Clustering test can be performed only with full-ha profile instances bound to full-ha-scokets.
    By default the domain.xml is configured to start the main-server-group that is configured with full profile and not full-ha and these instances startup by default. See host.xml

    References

    AS7 Clustering
    AS7 Clustering - alternative
    Simple cluster webapp
    mod_cluster
    Infinispan
    jGroups

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.