Wednesday, February 25, 2015

Setup JBoss Fuse Service Works In Domain Mode

Introduction

First of all, at this writing, the JBoss FSW does not work in domain mode. Hopefully, in the next release, this issue will be resolved. Run JBoss FSW in domain mode has a lot of advantages over standalone mode, in particular, with respect to the deployment and management.

In this blog, I will look into the details about the domain mode setup for JBoss EAP. In my previous blogs about JBoss FSW, I have covered the following topics:

  1. How to install and start JBoss FSW http://ggl-consulting.blogspot.com/2014/10/jboss-service-works-explained.html
  2. How to build, deploy, and test a simple JBoss FSW applications http://ggl-consulting.blogspot.com/2014/10/build-deploy-test-and-debug-jboss-fuse.html
  3. How to cluster JBoss FSW using TCP stack http://ggl-consulting.blogspot.com/2015/02/clustering-jboss-fsw-switchyard.html
  4. Run JBoss FSW As Service In Standalone Mode http://ggl-consulting.blogspot.com/2015/02/run-jboss-fsw-as-service.html

To setup domain mode, we need the following service components:

  1. Domain Controller: control the service nodes under the domain through the communication between domain controller --> host controller --> service nodes
  2. Host Controller: Responsible for the communication between service nodes and domain controller.
  3. Service Nodes: the container for JEE services.

The Topology

I have configured three RHL sandboxes for the setup of domain mode as shown in the following figure:

Setup Domain Controller

To setup domain controller, we need to edit two files [in my case JBOSS_FSW=/opt/app/fsw]:

$JBOSS_FSW/jboss-eap-6.1/domain/configuration/domain.xml
$JBOSS_FSW/jboss-eap-6.1/domain/configuration/host-master.xml

Modify domain.xml

For domain.xml, the only change need to made is the section of server-groups as the following:

  
    ...
    
        
            
                
                
            
            
        
    
 

Modify host-master.xml

The only change I need to make is the following line:




In the enterprise application, you may need to adjust the default jvm and ports options. In my previous blogs, I have covered how to enable various tcp ports by using the tool of system-config-firewall.

Add A Domain Admin User

In order for the host controller to communicate with domain controller, domain controller need to know which credential to use. And this is the purpose we have to create a domain admin user. This admin user will also be use to provision JBoss FSW nodes using cli commands as shown in later secsion. Here is the procedure to create doamin admin user:

[fuse@SANDBOXFUSEV04 bin]$ ./add-user.sh

What type of user do you wish to add?
 a) Management User (mgmt-users.properties)
 b) Application User (application-users.properties)
(a): a

Enter the details of the new user to add.
Realm (ManagementRealm) :
Username : domainadmin
Password :
Re-enter Password :
About to add user 'domainadmin' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'domainadmin' to file '/opt/app/fsw/jboss-eap-6.1/standalone/configuration/mgmt-users.properties'
Added user 'domainadmin' to file '/opt/app/fsw/jboss-eap-6.1/domain/configuration/mgmt-users.properties'
Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
yes/no? yes
To represent the user add the following to the server-identities definition 
[fuse@SANDBOXFUSEV04 bin]$

The last line of stdout contains the following text:


Make sure you save the line, we will need it to configure host controller.

Start Up The Domain Controller

To start the domain controller use the following command:

./domain.sh -b 10.66.13.120 -bmanagement 10.66.13.120 --host-config=host-master.xml

Note: the 10.66.13.120 is the ip address of the host of domain controller. You may setup service daemon as I did for standalone mode in the blog: http://ggl-consulting.blogspot.com/2015/02/run-jboss-fsw-as-service.html

Check The Domain Controller Using Web Browser

After starting the domain controller, we can check the status of the domain controller by enter the the url: sandboxfuse02:9990/console. It will promote login. You can use the domain admin credential or the one we setup earlier during the installation. The web browser should should the following.

As you can see, there is not server connected to the domain controller yet. This will change after we setup and start the host controller.

Setup Host Controller

Configuration

The only file to be modified in order to setup host controller is:

$JBOSS_FSW/jboss-eap-6.1.0/domain/configuration/host-slave.xml

There are three places need to be modify in the host-slave.xml as the follows:


    ...

            
                
                     
                     
                
    ....

    
       
    
    ...

    
        
    

  1. The is obtained during our creation of domainadmin user.
  2. In the domain-controller part, I add username="domainadmin". To me this should be put inside the server-identities.
  3. The last part is to define servers controlled by the host controller.

Start Host Controller

The host controller can be started using the following command:

./domain.sh -b 10.66.13.108 -bmanagement 10.66.13.108 -Djboss.domain.master.address=10.66.13.120 --host-config=host-slave.xml

Do the exactly the same for the other host controller. In my case the host controller will run on the host sandboxfusev04. As I start and stop the host congtroller, I can see the following stdout from the domain controller.

[Host Controller] 09:46:26,318 INFO  [org.jboss.as.domain] (slave-request-threads - 1) JBAS010918: Registered remote slave host "sandboxfusev03", JBoss Red Hat JBoss Fuse Service Works 6.0.0.GA-redhat-2 (AS 7.2.1.Final-redhat-10)
[Host Controller] 09:47:17,631 INFO  [org.jboss.as.domain] (slave-request-threads - 1) JBAS010918: Registered remote slave host "sandboxfusev04", JBoss Red Hat JBoss Fuse Service Works 6.0.0.GA-redhat-2 (AS 7.2.1.Final-redhat-10)
[Host Controller] 11:51:06,139 INFO  [org.jboss.as.domain] (Remoting "sandboxfusev02:MANAGEMENT" task-1) JBAS010925: Unregistered remote slave host "sandboxfusev03"
[Host Controller] 11:51:11,160 INFO  [org.jboss.as.domain] (Remoting "sandboxfusev02:MANAGEMENT" task-3) JBAS010925: Unregistered remote slave host "sandboxfusev04"

Looking Inside

After starting both host controller, we can also check the server status by using be web brower. First, let view the domain information from the domain controller as shown in the figure below:

We can see that two hosts are added: sandboxfusev03, sandboxfusev04. If we want to change the host name, we can add name="..." into host-slave.xml.

Summary

In this blog, I have covered the configuration of JBoss FSW in domain mode. In order to get familiarized the JBoss FSW, you may look into the log. If you encounter a problem, you should increase the level of server log by modifying logging.properties which is also under domain/configuration. You should also check which ports are open from firewall by using the command:
sudo iptables -L -v -n

3 comments:

  1. HI Gary,
    Can you please let me know if the jboss fuse service works 6.0 version support domain mode now?

    ReplyDelete
  2. Hi Gary,
    One question
    any check in command line for verification status jboss fuse ?
    Thanks and regards

    ReplyDelete
  3. Thanks for sharing, it was informative. We play a small role in upskilling people providing the latest tech courses. Join us to upgradeJBOSS FUSE ONLINE TRAINING

    ReplyDelete

Anypoint Studio Error: The project is missing Munit lIbrary to run tests

Anypoint Studio 7.9 has a bug. Even if we following the article: https://help.mulesoft.com/s/article/The-project-is-missing-MUnit-libraries-...