DC–DR Switchover and Switchback SOP
Switch HEAL from the DC site to DR and back.
Use this procedure to move HEAL from the primary data center (DC) to the disaster recovery (DR) site, for example for a DR drill or for DC maintenance, and to move it back afterwards. It assumes that the DR site has its own HEAL installation that mirrors DC.
Before you start#
- Agree on the switchover window with the customer's infrastructure team. The customer changes the HEAL DNS name, takes the VM snapshots and patches the servers; the HEAL team does the other steps.
- Replace the values in angle brackets with the values for your environment:
| Placeholder | Value |
|---|---|
| <a1home> | HEAL installation directory, for example /opt/Heal. |
| <DC_Percona_IP>, <DR_Percona_IP> | Address of the Percona (MySQL) server at DC and at DR. |
| <Percona_port> | Percona port. If it differs between the sites, use the port of the site in the command. |
| <connector_database> | A connector database. Connector database names start with dataadapter_. |
| <OpenSearch_IP>, <OpenSearch_port>, <OpenSearch_user> | Address, port and user name of OpenSearch at the site you check. |
| <HEAL_DNS_name> | The DNS name that users and agents use to reach HEAL. |
Note: Do not type passwords into commands. When you leave a password out, mysql, mysqldump, curl and keytool ask for it, so it is not saved in the shell history.
1. Pre-checks#
Do these steps before you switch over.
Back up DC and DR, and copy the data to DR#
- Ask the customer to take snapshots of the HEAL virtual machines.
-
On the DC Percona server, prepare a backup folder, remove old dump files from it, and list the connector databases:
mkdir -p /tmp/BACKUP_DUMPS_FOR_Activity rm -f /tmp/BACKUP_DUMPS_FOR_Activity/*.sql cd /tmp/BACKUP_DUMPS_FOR_Activity mysql -h <DC_Percona_IP> -P <Percona_port> -u dbadmin -p -e "SHOW DATABASES LIKE 'dataadapter%';" -
Dump the
appsonedatabase and each connector database:mysqldump -h <DC_Percona_IP> -P <Percona_port> -u dbadmin -p --source-data --routines --triggers appsone > appsone.sql mysqldump -h <DC_Percona_IP> -P <Percona_port> -u dbadmin -p --source-data --routines --triggers <connector_database> > <connector_database>.sql--source-dataworks on Percona 8.0 and 8.4. It replaces--master-data, which is deprecated. 4. Copy the dump files to/tmp/DC_DUMPS_LATESTon the DR Percona server, for example withscpor WinSCP. Remove older.sqlfiles from that folder first. 5. Back up the DR databases before you overwrite them:mkdir -p /tmp/Before_Activity_dump && cd /tmp/Before_Activity_dump mysqldump -h <DR_Percona_IP> -P <Percona_port> -u dbadmin -p --source-data --routines --triggers appsone > appsone.sql mysqldump -h <DR_Percona_IP> -P <Percona_port> -u dbadmin -p --source-data --routines --triggers <connector_database> > <connector_database>.sql -
Import the DC dumps into the DR Percona:
cd /tmp/DC_DUMPS_LATEST mysql -h <DR_Percona_IP> -P <Percona_port> -u dbadmin -p appsone < appsone.sql mysql -h <DR_Percona_IP> -P <Percona_port> -u dbadmin -p <connector_database> < <connector_database>.sql -
Point the connectors at the DR Percona. After the import, the
adapter_chain_repositorytable of each connector database still holds the DC address. Log in to the DR Percona and run this for each connector database. Only the address changes; the database names in the URLs stay as they are:USE <connector_database>; SELECT id, connection_url FROM adapter_chain_repository; UPDATE adapter_chain_repository SET connection_url = REPLACE(connection_url, '//<DC_Percona_IP>:<Percona_port>/', '//<DR_Percona_IP>:<Percona_port>/') WHERE connection_url LIKE '%//<DC_Percona_IP>:<Percona_port>/%'; SELECT id, connection_url FROM adapter_chain_repository;In the last output, every URL must show
<DR_Percona_IP>. 8. Check that each connector sends KPI data to the Data Receiver by DNS name, not by IP address, so that it keeps working after the DNS switch:SELECT * FROM <connector_database>.worker_parameters WHERE name = 'data-receiver.kpi.endpoint';The value must use the HEAL DNS name, for example
https://<HEAL_DNS_name>:<port>/raw-agents-kpi-data. If it uses an IP address, change it to the DNS name. 9. If a Kubernetes connector at DR connects to its clusters over TLS, import the certificates of each cluster into the connector's truststore. Without them, the connector fails with a PKIX error. On the DR application server that runs the connector:cd <a1home>/Appsone_Service/<connector_folder>/conf echo | openssl s_client -connect '<cluster_API_host>:6443' | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > cert.crt keytool -import -trustcacerts -keystore cacerts -noprompt -alias <unique_alias> -file cert.crtkeytoolasks for the truststore password. Repeat for the Thanos Querier address of the cluster (<thanos_querier_host>:443) and for each cluster, with a new alias each time. 10. Take an OpenSearch snapshot. If disk space is short, include at least the last 3 days of indices. See OpenSearch Snapshot and Restore. 11. Back up the Consul keys and the Nomad files:consul kv get -recurse > consulkey_backup cd <a1home> cp -rpf nomadFile nomadFile_backup
Compare the Component Agents#
- List the Component Agents installed at DC and at DR, with their install paths, and make sure that each agent has the same version at both sites.
- Note which agents run at DC: you stop them at switchover. The agent of the HEAL health account keeps running.
Check that DR matches DC#
In the screenshots on this page, IP addresses and host names are covered with gray bars, including the IP address at the start of names such as <server_IP>_UISERVICE_1.
- Network: All required ports are open, and the connections work at both sites.
-
HEAL module versions: Every HEAL module has the same version at both sites. Run this in
<a1home>/nomadFileat DC and at DR, and compare the output:grep -i image *.nomad | awk -F'=' '{print $2}' | tr -d ' "' | sort -u
Example from a HEAL v2.3.x system. Each line is an image and version that a job file uses; the registry address in front of it is covered. A module listed twice, such as heal-controlcenter, has job files with two versions. Install any version that is missing or different. - Infrastructure modules and services: The modules and services that run at DC also run at DR, with the same versions. For example, if DC runs a given version of the OpenTelemetry Collector load balancer, DR runs the same version. HAProxy is installed on the web servers at both sites. - Consul keys: Both sites have the same number of keys, with the same values, except IP addresses, ports and tuning values. Update any other value that differs. - Percona: Replication is in sync, and the Percona versions match. After the import, run this at both sites and compare the output: - Percona 8.0 (HEAL v2.3.x):
SHOW MASTER STATUS\G- Percona 8.4 (HEAL v2.4.1):SHOW BINARY LOG STATUS\G- OpenSearch: The cluster is healthy at both sites, zoning and indices are in sync, and the versions match. Check the health at each site;greenmeans healthy:curl -k -u <OpenSearch_user> "https://<OpenSearch_IP>:<OpenSearch_port>/_cat/health?pretty" -
Command Center and user access: Command Center users can open all Grafana and HEAL dashboards, and Keycloak LDAP synchronization works.
- Workaround scripts: Every workaround script and custom change that is in use at DC is also present at DR.
-
Ownership and permissions: The files of the infrastructure modules and HEAL services have the same owners and permissions as at DC. This includes
<a1home>/nomadFileand the module log folders in<a1home>/centralized_logs. Most belong to the HEAL service user and group (NOMAD_USERandNOMAD_GROUPingeneralConf.py). Keep<a1home>/centralized_logs/keycloakowned by1000:1000: Keycloak needs it to start.
Example: part of ls -l <a1home>/nomadFile. The job files belong to the HEAL service user and group (healsupport in this example). 
Example: part of ls -l <a1home>/centralized_logs. These module log folders belong to the HEAL service user and group. -
HEAL modules: Every HEAL module is up. For each job,
nomad status <job>showsStatus = running, a successful latest deployment, and as many Healthy allocations as Desired. For each allocation in its Allocations table,nomad status <allocation_ID>showsDeployment Health = healthy.
Example: nomad status <job> for a healthy job. Status is running, the latest deployment is successful, and Healthy equals Desired. The Allocations table gives the allocation ID for the next check. 
Example: nomad status <allocation_ID>, with the ID from the job's Allocations table, shows Deployment Health = healthy. -
Patches and upgrades: Any patch or upgrade applied at one site is also applied at the other site before the switchover.
2. Switch over to DR#
- The customer switches the HEAL DNS name from DC to DR.
-
Optional: to avoid false host availability alerts during the switchover, disable the
HEAL_HOST_AVAILABILITYthresholds. Log in to the DR Percona (mysql -h <DR_Percona_IP> -P <Percona_port> -u dbadmin -p appsone) and run these statements. Save the output of the first one: you need the IDs to enable the same thresholds again when you switch back.-- Check: list the enabled thresholds and save the output SELECT id, service_id, operation_type_id, applicable_to, status FROM service_kpi_thresholds WHERE kpi_id = ( SELECT id FROM mst_kpi_details WHERE identifier = 'HEAL_HOST_AVAILABILITY') AND status = 1; -- Disable them UPDATE service_kpi_thresholds SET status = 0 WHERE kpi_id = ( SELECT id FROM mst_kpi_details WHERE identifier = 'HEAL_HOST_AVAILABILITY') AND status = 1; -- Verify SELECT id, service_id, operation_type_id, applicable_to, status FROM service_kpi_thresholds WHERE kpi_id = ( SELECT id FROM mst_kpi_details WHERE identifier = 'HEAL_HOST_AVAILABILITY') AND status = 0; -
Stop HAProxy at DC, start it at DR, and check its status:
# At DC nomad stop -purge haproxy # At DR nomad run haproxy.nomad nomad status haproxy nomad status <allocation_ID> -
When HAProxy is healthy at DR, stop these at DC:
- All Component Agents, except the agent of the HEAL health account.
- The OpenTelemetry Collector:
nomad stop -purge otel-collector - The OpenTelemetry Collector load balancer. It does not run behind HAProxy: it runs from
run.shon a web server, in<a1home>/Appsone_Service/conf-template/heal-opentelemetry-collector/.
-
Start the Component Agents, the OpenTelemetry Collector load balancer and the OpenTelemetry Collector at DR, and check the collector:
nomad run otel-collector.nomad nomad status otel-collector nomad status <allocation_ID>Then check the collector logs for errors. 6. Stop any other service that uses the HEAL endpoints, except HAProxy, before you complete the switchover. Restart it only after the switchover has succeeded.
3. Validate#
Check that these work at DR:
- KPI data collection
- Connector data collection
- JIM data collection
- Signals
- Alerts
- Forensic logs
- Logstash data collection
- RabbitMQ queue limits
- SMS alerts
- HEAL UI
- Command Center
- Grafana
Record the results in the validation checklist:
| Validation item | Responsible team | Status (Pass/Fail) |
|---|---|---|
| Percona database synchronization | HEAL team | |
| Nomad jobs deployed | HEAL team | |
| Consul keys synchronized | HEAL team | |
| HAProxy and OpenTelemetry Collector stopped at DC | HEAL team | |
| OpenSearch snapshot and indices restored | HEAL team | |
| Custom KPIs, JIM and connectors | HEAL team | |
| Grafana and Command Center dashboards | Monitoring team | |
| RabbitMQ queues | HEAL team | |
| LDAP login | HEAL team |
4. Hand over DC for maintenance#
Do this when the customer patches or restarts the DC servers while HEAL runs at DR.
-
On the DC primary node, stop all HEAL services:
cd <a1home> ./stopServices.sh -f ALL -
On every DC node, stop the infrastructure services in this order:
systemctl stop nomad systemctl stop consul systemctl stop docker systemctl stop docker.socket systemctl stop firewalld -
After the customer has patched and restarted the servers, check with
uptimethat every server has restarted. -
On every DC node, start the infrastructure services in this order. Check each service with
systemctl status <service>before you start the next one:systemctl start firewalld systemctl start docker.socket systemctl start docker systemctl start consul systemctl start nomad -
Check that the clusters have formed again: in
consul members, every node isalive; innomad server members, every server isaliveand one server is the leader.
Example: every Consul member and Nomad server is alive, and one Nomad server is the leader. -
On the DC primary node, start the HEAL services, and check that every service is running:
cd <a1home> ./checkregistry.sh ./startServices.sh ALL nomad status
5. Switch back to DC#
- Make sure that DC has the data that HEAL wrote at DR: Percona and OpenSearch are in sync from DR to DC. For OpenSearch replication from DR to DC, see Data Center (DC) and Disaster Recovery (DR) Drill Steps.
- The customer switches the HEAL DNS name back to DC.
-
Stop HAProxy at DR, start it at DC, and check its status:
# At DR nomad stop -purge haproxy # At DC nomad run haproxy.nomad nomad status haproxy nomad status <allocation_ID> -
When HAProxy is healthy at DC, stop the Component Agents (except the agent of the HEAL health account), the OpenTelemetry Collector and its load balancer at DR. Then start them at DC, the same way as at DR in section 2.
-
If you disabled the
HEAL_HOST_AVAILABILITYthresholds, log in to the DC Percona (mysql -h <DC_Percona_IP> -P <Percona_port> -u dbadmin -p appsone) and enable the ones in your saved list again:UPDATE service_kpi_thresholds SET status = 1 WHERE id IN (<IDs from your saved list>); -
Validate HEAL at DC, as in section 3.