Skip to main content

Upgrade Moogsoft Onprem Tarball v9.0.x or v9.1.x to v9.2.0.1

This topic describes how to patch a Tarball-based distribution of Moogsoft Onprem to v9.2.0.1 from v9.0.0 or 9.0.0.x or 9.0.1.x, 9.1.0.x, or 9.1.1.x

Important

This process requires the presence of a third Moogsoft Onprem server to act a redundancy server as per : Fully Distributed HA Installation

If this server is not already provisioned and running, it must be provisioned before starting this process, and a clean installation of Moogsoft Onprem v9.2.0 performed on it, with just the RabbitMQ and OpenSearch processes left running

In the process below, Server 1 and Server 2 are existing Moogsoft Onprem servers running MoogFarmD, Apache-Tomcat, RabbitMQ etc

In the process below, Server 3 is the Redundancy Server running RabbitMQ and possibly OpenSearch too

  1. One-time multi-server upgrade step

    Update all Percona nodes to the latest version using the instructions here: Percona Cluster 8.4 Tarball Minor Version Upgrade

  2. On Server 1 or Server 2

    1. IMPORTANT: Make a note of the existing RabbitMQ Events.HA queue name by running this command:

      export PATH=$MOOGSOFT_HOME/cots/erlang/bin/:$PATH;
      VHOST=$(${MOOGSOFT_HOME}/bin/utils/moog_config_reader -k mooms.zone)
      ${MOOGSOFT_HOME}/cots/rabbitmq-server/sbin/rabbitmqctl -p "${VHOST}" list_queues | grep Events.HA | awk '{print $1}' | head -n 1

      This queue name is needed later in the upgrade process

  3. On Server 3

    1. Stop RabbitMQ

      $MOOGSOFT_HOME/bin/utils/process_cntl rabbitmq stop;
  4. On Server 1

    1. Remove the Server 3 RabbitMQ node from the cluster:

      export PATH=$MOOGSOFT_HOME/cots/erlang/bin/:$PATH;
      ${MOOGSOFT_HOME}/cots/rabbitmq-server/sbin/rabbitmqctl forget_cluster_node rabbit@<SERVER_3_IP_OR_HOSTNAME>
    2. Comment out any reference to the Server 1 RabbitMQ broker from $MOOGSOFT_HOME/config/system.conf

      The entry under mooms -> brokers should be commented out

    3. Comment out any reference to the Server 3 RabbitMQ broker from $MOOGSOFT_HOME/config/system.conf

      The entry under mooms -> brokers should be commented out

    4. Stop MoogFarmD to pause event processing

      $MOOGSOFT_HOME/bin/utils/process_cntl moog_farmd stop;
    5. Restart all Moogsoft Onprem services (excluding MoogFarmD)

      $MOOGSOFT_HOME/bin/utils/process_cntl apache-tomcat restart;
      $MOOGSOFT_HOME/bin/utils/process_cntl rest_lam restart;
      $MOOGSOFT_HOME/bin/utils/process_cntl socket_lam restart
  5. On Server 2

    1. Comment out any reference to the Server 1 and the Server 3 RabbitMQ brokers from $MOOGSOFT_HOME/config/system.conf

      The entries under mooms -> brokers should be commented out

    2. Stop MoogFarmD to pause event processing

      $MOOGSOFT_HOME/bin/utils/process_cntl moog_farmd stop;
    3. Restart all Moogsoft Onprem services (excluding MoogFarmD)

      $MOOGSOFT_HOME/bin/utils/process_cntl apache-tomcat restart;
      $MOOGSOFT_HOME/bin/utils/process_cntl rest_lam restart;
      $MOOGSOFT_HOME/bin/utils/process_cntl socket_lam restart
  6. On Server 3 (Redundancy Server)

    1. Stop all services

      $MOOGSOFT_HOME/bin/utils/process_cntl opensearch stop;
    2. Delete the RabbitMQ mnesia dir to reset RabbitMQ to prepare for the upgrade

      rm -rf $MOOGSOFT_HOME/var/lib/rabbitmq/mnesia/*
    3. Upgrade the packages on the server

    4. Create the RabbitMQ vhost and Events.HA quorum queue on that node (to allow events to queue here during the upgrade)

      VHOST=<your_vhost/zone_name>;
      $MOOGSOFT_HOME/bin/utils/moog_init_mooms.sh -pz ${VHOST};
      QUEUE_NAME="<YOUR_EVENTS_HA_QUEUE_NAME>";
      chmod u+x ${MOOGSOFT_HOME}/cots/rabbitmq-server/plugins/rabbitmq_management-*/priv/www/cli/rabbitmqadmin;
      ${MOOGSOFT_HOME}/cots/rabbitmq-server/plugins/rabbitmq_management-*/priv/www/cli/rabbitmqadmin -u moogsoft -p m00gs0ft --vhost=${VHOST} declare queue name=${QUEUE_NAME} durable=true arguments='{"x-queue-type":"quorum"}';
      ${MOOGSOFT_HOME}/cots/rabbitmq-server/plugins/rabbitmq_management-*/priv/www/cli/rabbitmqadmin -u moogsoft -p m00gs0ft --vhost=${VHOST} declare exchange name=MOOMS.GENERAL.TOPIC_EXCHANGE type=topic durable=true
      ${MOOGSOFT_HOME}/cots/rabbitmq-server/plugins/rabbitmq_management-*/priv/www/cli/rabbitmqadmin -u moogsoft -p m00gs0ft --vhost=${VHOST} declare binding source="MOOMS.GENERAL.TOPIC_EXCHANGE" destination_type="queue" destination="${QUEUE_NAME}" routing_key="events"
      
  7. On Server 2

    1. Confirm that the RabbitMQ HA policy is still present on the Events queue:

      export PATH=$MOOGSOFT_HOME/cots/erlang/bin/:$PATH;
      ${MOOGSOFT_HOME}/cots/rabbitmq-server/sbin/rabbitmqctl list_queues name durable policy -p <YOUR_VHOST> | grep Events.HA

      This command should return a value. If it does not, the policy should be reapplied with this command:

      ${MOOGSOFT_HOME}/cots/rabbitmq-server/sbin/rabbitmqctl set_policy -p <YOUR_ZONE> ha-all ".+.HA" '{"ha-mode":"all"}'
    2. Create a RabbitMQ shovel from the existing Events.HA queue to the Server 3 Events.HA queue to buffer events during the upgrade. Update the commands below with accurate variable values for the hostnames, VHosts, and credentials.

      SERVER_2_RABBITMQ_CREDS="moogsoft:m00gs0ft";
      SERVER_2_RABBITMQ_VHOST="<YOUR_VHOST_NAME>";
      SERVER_2_RABBITMQ_HOST="127.0.0.1";
      QUEUE="<YOUR_EVENTS_HA_QUEUE_NAME>";
      SERVER_3_RABBITMQ_CREDS="moogsoft:m00gs0ft";
      SERVER_3_RABBITMQ_VHOST="<YOUR_VHOST_NAME>";
      SERVER_3_RABBITMQ_HOST="YOUR_SERVER_3_IP_OR_HOSTNAME";
      export PATH=$MOOGSOFT_HOME/cots/erlang/bin/:$PATH;
      ${MOOGSOFT_HOME}/cots/rabbitmq-server/sbin/rabbitmq-plugins enable rabbitmq_shovel;
      ${MOOGSOFT_HOME}/cots/rabbitmq-server/sbin/rabbitmq-plugins enable rabbitmq_shovel_management;
      ${MOOGSOFT_HOME}/cots/rabbitmq-server/sbin/rabbitmqctl -p "${SERVER_2_RABBITMQ_VHOST}" set_parameter shovel my_shovel "$(cat <<EOF
      {
         "src-uri": "amqp://${SERVER_2_RABBITMQ_CREDS}@${SERVER_2_RABBITMQ_HOST}/${SERVER_2_RABBITMQ_VHOST}",
         "src-queue": "${QUEUE}",
         "dest-uri": "amqp://${SERVER_3_RABBITMQ_CREDS}@${SERVER_3_RABBITMQ_HOST}/${SERVER_3_RABBITMQ_VHOST}",
         "add-forward-headers": false,
         "dest-exchange": "MOOMS.GENERAL.TOPIC_EXCHANGE",
         "ack-mode": "on-confirm",
         "delete-after": "never"
      }
      EOF
      )"
    3. Confirm that the Shovel was created successfully by running the command below.

      The "state" must show "running" in this output. If the Shovel is not running at this stage, events may be lost depending on the overall process being carried out.

      ${MOOGSOFT_HOME}/cots/rabbitmq-server/sbin/rabbitmqctl -p <YOUR_VHOST> shovel_status
    4. Assuming that events are still being ingested via LAMs and UI integrations, the count for the Events.HA queue one the SERVER 3 node should now be increasing. You can check this by using this CLI command on Server 3:

      ${MOOGSOFT_HOME}/cots/rabbitmq-server/sbin/rabbitmqctl -p <YOUR_VHOST> list_queues
  8. On Server 1

    1. Confirm that the RabbitMQ HA policy is still present on the Events queue:

      export PATH=$MOOGSOFT_HOME/cots/erlang/bin/:$PATH;
      ${MOOGSOFT_HOME}/cots/rabbitmq-server/sbin/rabbitmqctl list_queues name durable policy -p <YOUR_VHOST> | grep Events.HA

      This command should return a value. If it does not, the policy should be reapplied with this command:

      ${MOOGSOFT_HOME}/cots/rabbitmq-server/sbin/rabbitmqctl set_policy -p <YOUR_VHOST> ha-all ".+.HA" '{"ha-mode":"all"}'
    2. Stop RabbitMQ

      $MOOGSOFT_HOME/bin/utils/process_cntl rabbitmq stop;
  9. On Server 2

    1. Remove the Server 1 RabbitMQ node from the cluster:

      export PATH=$MOOGSOFT_HOME/cots/erlang/bin/:$PATH;
      ${MOOGSOFT_HOME}/cots/rabbitmq-server/sbin/rabbitmqctl forget_cluster_node rabbit@<SERVER_1_IP_OR_HOSTNAME>
  10. On Server 1

    1. Stop all services (update the commands below as needed)

      $MOOGSOFT_HOME/bin/utils/process_cntl moog_farmd stop;
      $MOOGSOFT_HOME/bin/utils/process_cntl apache-tomcat stop;
      kill -9 $(ps -ef | grep java | grep lam | awk '{print $2}') 2>/dev/null;
      (crontab -l | sed -e 's/^\(.*events_analyser.*\)$/#\1/') | crontab -
      (crontab -l | sed -e 's/^\(.*keepalive.*\)$/#\1/') | crontab -
      ps -ef | grep java | egrep 'events_analyser|keepalive' | awk '{print $2}' | xargs kill 2>/dev/null;
      kill -9 $(ps -ef | grep java | grep Broker | awk '{print $2}') 2>/dev/null;
      
    2. Delete the RabbitMQ mnesia dir to reset RabbitMQ to prepare for the upgrade

      rm -rf $MOOGSOFT_HOME/var/lib/rabbitmq/mnesia/*
    3. Upgrade the packages on the server

    4. Upgrade the database schema

    5. If the Enrichment Database (Create the Enrichment API Data Store) is being used, ensure the schema is updated using the schema update command on that page.

    6. Cluster RabbitMQ with the Node 3 RabbitMQ

    7. Update the RabbitMQ brokers in $MOOGSOFT_HOME/config/system.conf to include Server 1 and Server 3

      The entries under mooms -> brokers should be added or uncommented as needed

    8. Upgrade Apache-Tomcat

    9. Perform final checks

    10. Start the LAMs (update the commands below as needed)

      $MOOGSOFT_HOME/bin/utils/process_cntl rest_lam restart
      $MOOGSOFT_HOME/bin/utils/process_cntl socket_lam restart
  11. On Server 2

    1. Stop Tomcat and LAMs (update the commands below as needed)

      $MOOGSOFT_HOME/bin/utils/process_cntl apache-tomcat stop;
      kill -9 $(ps -ef | grep java | grep lam | awk '{print $2}') 2>/dev/null;
      (crontab -l | sed -e 's/^\(.*events_analyser.*\)$/#\1/') | crontab -
      (crontab -l | sed -e 's/^\(.*keepalive.*\)$/#\1/') | crontab -
      ps -ef | grep java | egrep 'events_analyser|keepalive' | awk '{print $2}' | xargs kill 2>/dev/null;
      kill -9 $(ps -ef | grep java | grep Broker | awk '{print $2}') 2>/dev/null;
    2. Wait for the old Events.HA RabbitMQ queue to drain via the shovel to the new nodes. The command below needs to return a value of 0 before proceeding:

      export PATH=$MOOGSOFT_HOME/cots/erlang/bin/:$PATH;
      VHOST=$(${MOOGSOFT_HOME}/bin/utils/moog_config_reader -k mooms.zone)
      ${MOOGSOFT_HOME}/cots/rabbitmq-server/sbin/rabbitmqctl -p "${VHOST}" list_queues name messages | grep Events.HA
    3. Stop RabbitMQ

      $MOOGSOFT_HOME/bin/utils/process_cntl rabbitmq stop;
      
    4. Delete the RabbitMQ mnesia dir to reset RabbitMQ to prepare for the upgrade

      rm -rf $MOOGSOFT_HOME/var/lib/rabbitmq/mnesia/*
    5. Upgrade the packages on the server

    6. Cluster RabbitMQ with Server 3 RabbitMQ

    7. Update the RabbitMQ brokers in $MOOGSOFT_HOME/config/system.conf to include Server 1 and Server 2, and Server 3

      The entries under mooms -> brokers should be added or uncommented as needed

    8. Upgrade Apache-Tomcat

      Warning

      This process will completely remove and re-deploy Apache-Tomcat. If the Apache-Tomcat logs need to be kept, a copy should be made before proceeding.

      Deploy the new version of Apache Tomcat with the latest webapps, and Nginx:

      IMPORTANT: If the Xmx value for apache-tomcat has been changed from the default in the $MOOGSOFT_HOME/bin/utils/process_cntl script, ensure the customised value is replaced after the upgrade, then restart the apache-tomcat process.

      Run these commands in the same terminal as the one where the variables were saved previously.

      $MOOGSOFT_HOME/bin/utils/process_cntl nginx stop;
      $MOOGSOFT_HOME/bin/utils/moog_init_ui.sh -tnfwz $($MOOGSOFT_HOME/bin/utils/moog_config_reader -k mooms.zone) --accept-eula
      cp -f $CERT_REAL_PATH_PEM $MOOGSOFT_HOME/cots/nginx/ssl/;
      cp -f $CERT_REAL_PATH_KEY $MOOGSOFT_HOME/cots/nginx/ssl/;
      sed -i "s|.*ssl_certificate .*|${CERT_PATH_PEM}|" $MOOGSOFT_HOME/cots/nginx/config/conf.d/moog-ssl.conf;
      sed -i "s|.*ssl_certificate_key.*|${CERT_PATH_KEY}|" $MOOGSOFT_HOME/cots/nginx/config/conf.d/moog-ssl.conf;
      $MOOGSOFT_HOME/bin/utils/process_cntl nginx restart;
    9. Perform final checks

      1. Validate the patch:

        $MOOGSOFT_HOME/bin/utils/moog_install_validator.sh
        $MOOGSOFT_HOME/bin/utils/tomcat_install_validator.sh
        $MOOGSOFT_HOME/bin/utils/moog_db_validator.sh

        If there are any errors from the above validators, please contact Moogsoft Support.

      2. Re-start non-UI integrations or LAMs

      3. Important

        Re-install the latest Add-ons pack: Install Moogsoft Add-ons

      4. The OpenSearch Cluster now needs to be recreated: Opensearch Clustering Guide - Tarball

      5. Restart any event feeds if they were stopped

    10. Start the LAMs (update the commands below as needed)

      $MOOGSOFT_HOME/bin/utils/process_cntl rest_lam restart
      $MOOGSOFT_HOME/bin/utils/process_cntl socket_lam restart
  12. On Server 1

    1. Ensure all RabbitMQ quorum queues are updated to have the right number of replicas:

      export PATH=$MOOGSOFT_HOME/cots/erlang/bin/:$PATH;
      ${MOOGSOFT_HOME}/cots/rabbitmq-server/sbin/rabbitmq-queues grow rabbit@<SERVER1_HOSTNAME_OR_IP> all;
      ${MOOGSOFT_HOME}/cots/rabbitmq-server/sbin/rabbitmq-queues grow rabbit@<SERVER2_HOSTNAME_OR_IP> all;
      ${MOOGSOFT_HOME}/cots/rabbitmq-server/sbin/rabbitmq-queues grow rabbit@<SERVER3_HOSTNAME_OR_IP> all;
    2. Update the RabbitMQ brokers in $MOOGSOFT_HOME/config/system.conf to include Server 1 and Server 2, and Server 3

      The entries under mooms -> brokers should be added or uncommented as needed

    3. Start MoogFarmD

      $MOOGSOFT_HOME/bin/utils/process_cntl moog_farmd restart
    4. Restart Apache-Tomcat

      $MOOGSOFT_HOME/bin/utils/process_cntl apache-tomcat restart
  13. On Server 2

    1. Start MoogFarmD

      $MOOGSOFT_HOME/bin/utils/process_cntl moog_farmd restart
  14. Upgrade the Moogsoft Bridge server(s) :