Initializing the UI Moogsoft Services

The next step in the HA installation is to set up user interface services on your primary and secondary nodes. The UI services can run in either active/passive mode behind a load balancer, in which case the services it connects to also needs to be behind a load balancer, or they can run in active/active mode, which is a simpler setup and the one that we will implement.

Overview

Remember that the Moogsoft RPM packages for all services have already been installed on your nodes, and you will only need to initialize them for this exercise. In a "real world" scenario, you'd first need to install each RPM package before initializing it.

You will fulfill the following requirements:

  • Initialize the UI (Apache Tomcat and Nginx) service on the primary and secondary nodes, using the standard Moogsoft init script for the UI with the command (all on one line):

    moog_init_ui.sh -twfz HA_TRAIN -c <DNS-name>:15672 -m <DNS-name>:5672 -s <DNS-name>:9200 -d <DNS-name>:3309 -n --accept-eula

    where <DNS-name> is the DNS name for the node (the one for the primary on the primary, and the one for the secondary on the secondary). When prompted for the hostname fo Nginx, use the xxx-primary-ha.labs.moogsoft.com URL, which is what you will use to access the instance's UI. This value will be placed in the servlets.conf's webhost property. The command switches work as follows:

    t

    Installs Tomcat

    w

    Rebuilds the web apps in Tomcat

    f

    Configures Tomcat

    z

    Uses the supplied ZONE value, in this case HA_TRAIN

    c

    Host and port for the MooMs web console

    m

    Host and port for the MooMs service

    s

    Host and port for the Search service

    d

    Host and port for the database service (in this case ha_proxy)

    n

    Configure Nginx

    --accept-eula

    Do not display the EULA and prompt for acceptance

  • Set up HA for the UI service on your primary and secondary nodes by editing their servlets.conf files and uncommenting the ha section in both files. The properties should be as follows:

    1. Primary Node:

      1. group: "ui-primary"

      2. instance: "ui-on-primary"

      3. start_as_passive: false

    2. Secondary Node:

      1. group: "ui2-secondary"

      2. instance: "ui-on-secondary"

      3. start_as_passive: false

      Note

      The cluster value will be obtained from system.conf, so does not need to be included here. Be careful with preceding commas and other JSON syntax rules.

  • Start the UI service on your primary and secondary nodes and use HA control utility to verify that the HA cluster status is correct.

    ha_cntl -v

Note

If you know how to set up and test the UI services (Apache Tomcat, Nginx) on your primary and secondary nodes in active/active mode, you are encouraged to try to implement the exercise using the solution design above and your knowledge based on our discussion in class. If you are unsure of how to proceed or if you get stuck, you can read on for the full step-by-step solution.

Step-By-Step Solution

  1. Connect to your primary node via SSH and become root.

  2. Change to the $MOOGSOFT_HOME/bin/utils directory and run the command:

    moog_init_ui.sh -twfz HA_TRAIN -c <primary-DNS-name>:15672 -m <primary-DNS-name>:5672 -s <primary-DNS-name>:9200 -d <primary-DNS-name>:3309 -n --accept-eula

    Where <primary-DNS-name> is the hostname of the primary server (eg ip-172-31-13-94).

    When you are asked whether you should change the Nginx URL, type y to change it, and enter the URL you will use to access the Moogsoft UI, minus the starting https://

    (Example: jyoti-andersen13664-primary-ha.labs.moogsoft.com). When asked to confirm your input, make sure it is correct, and confirm.

  3. Once initialization is complete, change to the $MOOGSOFT_HOME/config directory and edit the servlets.conf file to uncomment and edit the ha section. Note that the cluster property value will be obtained from system.conf and should be removed here, and that you must add a comma before the ha section to comply with JSON syntax. The finished ha section should look like this:

    ,ha :
    {
        instance: "ui-on-primary",
        group: "ui-primary",
        start_as_passive: false
    }

    When you are done editing the properties, save the file.

  4. Connect to your secondary node, become root, and perform step 2 above, but use the secondary-DNS-name in all places where you used the primary-DNS-name on the primary node in the initialization command. When prompted during initialization, set the Nginx URL to the secondary node's URL instead of the primary's.

  5. Once initialization has completed, change to the $MOOGSOFT_HOME/config directory and edit the servlets.conf file to uncomment the ha section and set its properties.

    Note

    You must remove the cluster property and add a comma before the ha section once you uncomment it to comply with JSON syntax. The finished ha section should look like this:

    ,ha :
    {
        instance: "ui-on-secondary",
        group: "ui-secondary",
        start_as_passive: false
    }

    When you are done editing the properties, save the file.

  6. On your primary node, restart the UI service by running the command:

    systemctl restart apache-tomcat 

    and wait about one minute for Tomcat to completely initialize.

  7. Perform step 6 above on your secondary instance.

  8. Once your Tomcat servers have completely initialized (it can take up to 2 minutes), you should now have the UI services in an active/active HA pair. You can test your work on the UI and the entire HA solution by running the command:

    ha_cntl -v

    from your primary instance. The output should confirm that you have:

    1. The Moogfarmd service in active/passive mode, with the primary node active and the secondary node passive

    2. The UI service in active/active mode with both primary and secondary nodes active

This concludes the lab section.