Bookmark this page

Lab: Configuring Servers in a Managed Domain

Configure servers and server groups in a managed domain, and deploy the kitchensink application.

Resources
Files

/opt/domain

/home/student/AD248/labs/domainconf-review

Application URL http://172.25.250.10:8080/helloworld-mdb http://172.25.250.11:8080/helloworld-mdb

Outcomes

You should be able to configure an Red Hat JBoss Enterprise Application Platform (JBoss EAP) managed domain with two server groups and four servers and deploy the helloworld-mdb application.

Use the following command to prepare the environment:

[student@workstation ~]$ lab start domainconf-review

A JBoss EAP administrator has set up a managed domain with two host controllers running on servera and serverb machines. The domain controller runs on the workstation machine. The domain and host configuration files are stored in the /opt/domain directory on all three machines. In this exercise you start the managed domain and then create new servers and server groups following this diagram:

As a final step, you deploy the helloworld-mdb application WAR file on one of the newly created server groups. This application requires the use of the messaging subsystem. You must use the full profile of JBoss EAP to deploy the application on the domain. You can choose either the JBoss EAP management console or the management CLI to achieve your objectives, keeping in mind that the management CLI is the preferred option in production environments.

Instructions

  1. Briefly review the domain controller configuration on the workstation machine. Review the /opt/domain/configuration/host-master.xml, and /opt/domain/configuration/domain.xml files to understand how the managed domain is configured. Verify that there are no server groups defined in the domain.xml file.

  2. Start the domain controller on the workstation machine.

    Use /opt/domain as the value of the jboss.domain.base.dir variable for the domain.sh startup script. The host file for the domain controller is /opt/domain/configuration/host-master.xml. Use this file as the value for the --host-config=host-master.xml argument.

    Note that the /opt/domain directory is owned by the jboss user. Thus, you must start the domain controller by using sudo -u jboss /opt/jboss-eap-7.4/bin/domain.sh …​.

    [student@workstation ~]$ sudo -u jboss /opt/jboss-eap-7.4/bin/domain.sh \
    -Djboss.domain.base.dir=/opt/domain/ --host-config=host-master.xml
  3. The two host controllers on servera and serverb connect to the domain controller and fetch the latest domain configuration.

    Start the two host controllers on servera and serverb.

    1. Briefly review the host controller configuration on servera and serverb.

      Review the /opt/domain/configuration/host-slave.xml file to understand how the hosts are configured. Verify that there are no servers defined on either host.

    2. Start the host controller on servera.

      Open a new terminal window on the servera machine and use /opt/domain as the value of the jboss.domain.base.dir variable for the domain.sh startup script. The host file for this secondary controller is /opt/domain/configuration/host-slave.xml. Use this file as the value for the --host-config=host-slave.xml argument.

      Note that the /opt/domain directory is owned by the jboss user. Thus, you must start the host controller by using sudo -u jboss /opt/jboss-eap-7.4/bin/domain.sh …​.

      [student@servera ~]$ sudo -u jboss /opt/jboss-eap-7.4/bin/domain.sh \
      -Djboss.domain.base.dir=/opt/domain/ \
      -Djboss.domain.master.address=172.25.250.9 \
      --host-config=host-slave.xml
    3. Start the host controller on serverb.

      Open a new terminal window on the serverb machine and use /opt/domain as the value of the jboss.domain.base.dir variable for the domain.sh startup script. The host file for this secondary controller is /opt/domain/configuration/host-slave.xml. Use this file as the value for the --host-config=host-slave.xml argument.

      Note that the /opt/domain directory is owned by the jboss user. Thus, you must start the host controller using sudo -u jboss /opt/jboss-eap-7.4/bin/domain.sh …​.

      [student@serverb ~]$ sudo -u jboss /opt/jboss-eap-7.4/bin/domain.sh \
      -Djboss.domain.base.dir=/opt/domain/ \
      -Djboss.domain.master.address=172.25.250.9 \
      --host-config=host-slave.xml
    4. Verify that both host controllers connect to the domain controller and form a managed domain.

      Inspect the console window where you started the domain controller, and verify that both servera and serverb are registered as secondary host controllers to the domain controller.

      [Host Controller] 03:13:10,142 INFO  [org.jboss.as.domain.controller] (Host Controller Service Threads - 36) WFLYHC0019: Registered remote slave host "servera", JBoss JBoss EAP 7.4.11.GA (WildFly 15.0.26.Final-redhat-00001)
      [Host Controller] 03:14:04,404 INFO  [org.jboss.as.domain.controller] (Host Controller Service Threads - 36) WFLYHC0019: Registered remote slave host "serverb", JBoss JBoss EAP 7.4.11.GA (WildFly 15.0.26.Final-redhat-00001)
  4. In a new terminal window on the workstation machine, start the management CLI and connect to the domain controller as the jboss user:

    [student@workstation ~]$ sudo -u jboss /opt/jboss-eap-7.4/bin/jboss-cli.sh \
    --connect --controller=172.25.250.9:9990
    [domain@172.25.250.9:9990 /]
  5. There are no server groups or servers in the managed domain. To deploy the helloworld-mdb application, you must create server groups and define servers.

    Create two Group1 and Group2 server groups in the managed domain. One group represents a development environment, and the other a production environment. Thus, both server groups use the same JBoss EAP profile.

    1. The helloworld-mdb application uses the messaging subsystem from JBoss EAP. The messaging subsystem is only present in the full, or full-ha profiles. Create the Group1 server group based on the following criteria:

      FieldValue
      Name Group1
      Profile full
      Socket Binding Group full-sockets
      [domain@172.25.250.9:9990 /] /server-group=Group1:add\
      (profile=full,socket-binding-group=full-sockets)
      {
          "outcome" => "success",
          "result" => undefined,
          "server-groups" => undefined
      }
    2. Create the Group2 server group based on the following criteria:

      FieldValue
      Name Group2
      Profile full
      Socket Binding Group full-sockets
      [domain@172.25.250.9:9990 /] /server-group=Group2:add\
      (profile=full,socket-binding-group=full-sockets)
      {
          "outcome" => "success",
          "result" => undefined,
          "server-groups" => undefined
      }
    3. Verify the server groups that you created in the steps above by using either the management console or the management CLI.

      [domain@172.25.250.9:9990 /] /server-group=Group1:read-resource
      {
          "outcome" => "success",
          "result" => {
              "graceful-startup" => true,
              "management-subsystem-endpoint" => false,
              "profile" => "full",
              "socket-binding-default-interface" => undefined,
              "socket-binding-group" => "full-sockets",
              "socket-binding-port-offset" => 0,
      ...output omitted...
          }
      }
      [domain@172.25.250.9:9990 /] /server-group=Group2:read-resource
      {
          "outcome" => "success",
          "result" => {
              "graceful-startup" => true,
              "management-subsystem-endpoint" => false,
              "profile" => "full",
              "socket-binding-default-interface" => undefined,
              "socket-binding-group" => "full-sockets",
              "socket-binding-port-offset" => 0,
      ...output omitted...
          }
      }
  6. Define four servers. Create the servers and assign them to the appropriate groups. Verify that when you run multiple servers on a host, you must configure the port offsets correctly to avoid port clashes. Verify also that the servers are set to automatically start when the host controller is started or restarted.

    1. Create a servera.1 server on the servera host controller based on the following criteria:

      FieldValue
      Name servera.1
      Server Group Group1
      Socket Binding Port Offset 0
      Auto Start true
      [domain@172.25.250.9:9990 /] /host=servera/server-config=servera.1:add\
      (auto-start=true,group=Group1,socket-binding-port-offset=0)
      {
          "outcome" => "success",
      ...output omitted...
      }
    2. Create a servera.2 server on the servera host controller based on the following criteria:

      FieldValue
      Name servera.2
      Server Group Group2
      Socket Binding Port Offset 100
      Auto Start true
      [domain@172.25.250.9:9990 /] /host=servera/server-config=servera.2:add\
      (auto-start=true,group=Group2,socket-binding-port-offset=100)
      {
          "outcome" => "success",
      ...output omitted...
      }
    3. Create a serverb.1 server on the serverb host controller based on the following criteria:

      FieldValue
      Name serverb.1
      Server Group Group1
      Socket Binding Port Offset 0
      Auto Start true
      [domain@172.25.250.9:9990 /] /host=serverb/server-config=serverb.1:add\
      (auto-start=true,group=Group1,socket-binding-port-offset=0)
      {
          "outcome" => "success",
      ...output omitted...
      }
    4. Create a serverb.2 server on the serverb host controller based on the following criteria:

      FieldValue
      Name serverb.2
      Server Group Group2
      Socket Binding Port Offset 100
      Auto Start true
      [domain@172.25.250.9:9990 /] /host=serverb/server-config=serverb.2:add\
      (auto-start=true,group=Group2,socket-binding-port-offset=100)
      {
          "outcome" => "success",
      ...output omitted...
      }
  7. Start the new servers.

    You can start all of the servers in a server group with one command.

    1. Start the servers in the Group1 server group.

      [domain@172.25.250.9:9990 /] /server-group=Group1:\
      start-servers(blocking=true)
      {
          "outcome" => "success",
      ...output omitted...
      }
    2. Start the servers in the Group2 server group.

      [domain@172.25.250.9:9990 /] /server-group=Group2:\
      start-servers(blocking=true)
      {
          "outcome" => "success",
      ...output omitted...
      }
    3. Verify that the servers started successfully by inspecting the console windows where you started the host controllers.

      Note

      You can safely ignore the following output:

      WARNING: An illegal reflective access operation has occurred
      WARNING: Illegal reflective access by org.wildfly.extension.elytron.SSLDefinitions (jar:file:/opt/jboss-eap-7.4/modules/system/layers/base/.overlays/layer-base-jboss-eap-7.4.11.CP/org/wildfly/extension/elytron/main/wildfly-elytron-integration-15.0.26.Final-redhat-00001.jar!/) to method com.sun.net.ssl.internal.ssl.Provider.isFIPS()
      WARNING: Please consider reporting this to the maintainers of org.wildfly.extension.elytron.SSLDefinitions
      WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
      WARNING: All illegal access operations will be denied in a future release

      Refer to https://access.redhat.com/solutions/4996491.

    ...output omitted...
    [Host Controller] 03:49:19,938 INFO  [org.jboss.as.host.controller] (Host Controller Service Threads - 9) WFLYHC0023: Starting server servera.1
    03:49:20,139 INFO  [org.jboss.as.process.Server:servera.1.status] (ProcessController-threads - 4) WFLYPC0018: Starting process 'Server:servera.1'
    [Host Controller] 03:49:22,246 INFO  [org.jboss.as.host.controller] (management task-1) WFLYHC0021: Server [Server:servera.1] connected using connection [Channel ID 1d54691f (inbound) of Remoting connection 0cc9ab70 to servera.lab.example.com/172.25.250.10:59750 of endpoint "servera:MANAGEMENT" <25df8f46>]
    [Host Controller] 03:49:22,329 INFO  [org.jboss.as.host.controller] (server-registration-threads - 1) WFLYHC0020: Registering server servera.1
    ...output omitted...
    [Host Controller] 03:49:47,458 INFO  [org.jboss.as.host.controller] (Host Controller Service Threads - 9) WFLYHC0023: Starting server servera.2
    03:49:47,627 INFO  [org.jboss.as.process.Server:servera.2.status] (ProcessController-threads - 4) WFLYPC0018: Starting process 'Server:servera.2'
    [Host Controller] 03:49:49,691 INFO  [org.jboss.as.host.controller] (management task-1) WFLYHC0021: Server [Server:servera.2] connected using connection [Channel ID 57793411 (inbound) of Remoting connection 2b290581 to servera.lab.example.com/172.25.250.10:59752 of endpoint "servera:MANAGEMENT" <25df8f46>]
    [Host Controller] 03:49:49,733 INFO  [org.jboss.as.host.controller] (server-registration-threads - 1) WFLYHC0020: Registering server servera.2
    ...output omitted...
    ...output omitted...
    [Host Controller] 03:49:19,839 INFO  [org.jboss.as.host.controller] (Host Controller Service Threads - 10) WFLYHC0023: Starting server serverb.1
    03:49:20,017 INFO  [org.jboss.as.process.Server:serverb.1.status] (ProcessController-threads - 4) WFLYPC0018: Starting process 'Server:serverb.1'
    [Host Controller] 03:49:22,368 INFO  [org.jboss.as.host.controller] (management task-1) WFLYHC0021: Server [Server:serverb.1] connected using connection [Channel ID 6f307405 (inbound) of Remoting connection 4796828c to serverb.lab.example.com/172.25.250.11:58178 of endpoint "serverb:MANAGEMENT" <3523b8b8>]
    [Host Controller] 03:49:22,420 INFO  [org.jboss.as.host.controller] (server-registration-threads - 1) WFLYHC0020: Registering server serverb.1
    ...output omitted...
    [Host Controller] 03:49:47,359 INFO  [org.jboss.as.host.controller] (Host Controller Service Threads - 10) WFLYHC0023: Starting server serverb.2
    03:49:47,493 INFO  [org.jboss.as.process.Server:serverb.2.status] (ProcessController-threads - 4) WFLYPC0018: Starting process 'Server:serverb.2'
    [Host Controller] 03:49:49,658 INFO  [org.jboss.as.host.controller] (management task-1) WFLYHC0021: Server [Server:serverb.2] connected using connection [Channel ID 46cf249f (inbound) of Remoting connection 2fb016eb to serverb.lab.example.com/172.25.250.11:58180 of endpoint "serverb:MANAGEMENT" <3523b8b8>]
    [Host Controller] 03:49:49,727 INFO  [org.jboss.as.host.controller] (server-registration-threads - 1) WFLYHC0020: Registering server serverb.2
    ...output omitted...
  8. The JBoss EAP managed domain is ready to deploy the helloworld-mdb.war application file. The helloworld-mdb.war file is available in two locations on the workstation machine: /home/student/AD248/labs/domainconf-review/helloworld-mdb.war, with the student user ownership; and /tmp/helloworld-mdb.war, with the jboss user ownership

    1. Application deployments in a managed domain are always done at the server groups level. Each application belongs to one or more server groups. Deploy the helloworld-mdb.war file to the Group1 server group.

      Verify that the helloworld-mdb.war file is deployed on servera.1 and serverb.1 because they are part of the Group1 server group. Inspect the console window of servera and serverb for any error messages or warnings.

      [domain@172.25.250.9:9990 /] deploy \
      /tmp/helloworld-mdb.war --server-groups=Group1
    2. Verify that you can access the helloworld-mdb application at http://172.25.250.10:8080/helloworld-mdb and http://172.25.250.11:8080/helloworld-mdb.

    3. Verify that you cannot access the helloworld-mdb application at http://172.25.250.10:8180/helloworld-mdb or http://172.25.250.11:8180/helloworld-mdb because these servers are part of Group2, and you have not deployed the application on the Group2 server group.

  9. Use either the administration console or the JBoss EAP CLI to undeploy the helloworld-mdb application and shut down the servers, server groups, host controllers, and the entire managed domain.

    1. Stop servera.1.

      [domain@172.25.250.9:9990 /] /host=servera/server=servera.1:stop
      {
          "outcome" => "success",
          "result" => "STOPPING"
      }
    2. Verify that the helloworld-mdb application is no longer accessible from servera.1 but still accessible from serverb.1.

      Verify that the helloworld-mdb application is not accessible at URL http://172.25.250.10:8080/helloworld-mdb. The helloworld-mdb application should still be accessible at http://172.25.250.11:8080/helloworld-mdb because serverb.1 is still running.

    3. Undeploy the helloworld-mdb application.

      [domain@172.25.250.9:9990 /] undeploy helloworld-mdb.war \
      --all-relevant-server-groups
    4. Stop all servers in the Group1 server group. Verify that the helloworld-mdb application is no longer accessible.

      [domain@172.25.250.9:9990 /] /server-group=Group1:stop-servers
      {
          "outcome" => "success",
          "result" => undefined,
          "server-groups" => undefined
      }
    5. Stop the servers in the Group2 server group.

      [domain@172.25.250.9:9990 /] /server-group=Group2:stop-servers
      {
          "outcome" => "success",
          "result" => undefined,
          "server-groups" => undefined
      }
    6. Shut down the host controller on servera. Inspect the console window of servera, and verify that the host controller has been shut down.

      [domain@172.25.250.9:9990 /] /host=servera:shutdown
      {
          "outcome" => "success",
          "result" => undefined
      }
    7. Shut down the host controller on serverb. Inspect the console window of serverb, and verify that the host controller has been shut down.

      [domain@172.25.250.9:9990 /] /host=serverb:shutdown
      {
          "outcome" => "success",
          "result" => undefined
      }
  10. In the terminal where the domain controller runs, press Ctrl+C to stop it.

    Alternatively, you can shut down the domain controller by using the management CLI.

    Then, run the following command from the workstation to grade the exercise:

    [student@workstation bin]$ lab grade domainconf-review

Finish

As the student user on the workstation machine, use the lab command to complete this exercise. This step is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish domainconf-review

Revision: ad248-7.4-18a9db2