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
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
On Server 1 or Server 2
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 1This queue name is needed later in the upgrade process
On Server 3
Stop RabbitMQ
$MOOGSOFT_HOME/bin/utils/process_cntl rabbitmq stop;
On Server 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>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
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
Stop MoogFarmD to pause event processing
$MOOGSOFT_HOME/bin/utils/process_cntl moog_farmd stop;
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
On Server 2
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
Stop MoogFarmD to pause event processing
$MOOGSOFT_HOME/bin/utils/process_cntl moog_farmd stop;
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
On Server 3 (Redundancy Server)
Stop all services
$MOOGSOFT_HOME/bin/utils/process_cntl opensearch stop;
Delete the RabbitMQ mnesia dir to reset RabbitMQ to prepare for the upgrade
rm -rf $MOOGSOFT_HOME/var/lib/rabbitmq/mnesia/*
Upgrade the packages on the server
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"
On Server 2
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.HAThis 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"}'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 )"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_statusAssuming 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
On Server 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.HAThis 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"}'Stop RabbitMQ
$MOOGSOFT_HOME/bin/utils/process_cntl rabbitmq stop;
On Server 2
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>
On Server 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;Delete the RabbitMQ mnesia dir to reset RabbitMQ to prepare for the upgrade
rm -rf $MOOGSOFT_HOME/var/lib/rabbitmq/mnesia/*
Upgrade the packages on the server
Upgrade the database schema
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.
Cluster RabbitMQ with the Node 3 RabbitMQ
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
Upgrade Apache-Tomcat
Perform final checks
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
On Server 2
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;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.HAStop RabbitMQ
$MOOGSOFT_HOME/bin/utils/process_cntl rabbitmq stop;
Delete the RabbitMQ mnesia dir to reset RabbitMQ to prepare for the upgrade
rm -rf $MOOGSOFT_HOME/var/lib/rabbitmq/mnesia/*
Upgrade the packages on the server
Cluster RabbitMQ with Server 3 RabbitMQ
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
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;Perform final checks
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.
Re-start non-UI integrations or LAMs
Important
Re-install the latest Add-ons pack: Install Moogsoft Add-ons
The OpenSearch Cluster now needs to be recreated: Opensearch Clustering Guide - Tarball
Restart any event feeds if they were stopped
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
On Server 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;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
Start MoogFarmD
$MOOGSOFT_HOME/bin/utils/process_cntl moog_farmd restart
Restart Apache-Tomcat
$MOOGSOFT_HOME/bin/utils/process_cntl apache-tomcat restart
On Server 2
Start MoogFarmD
$MOOGSOFT_HOME/bin/utils/process_cntl moog_farmd restart
Upgrade the Moogsoft Bridge server(s) :