DC-DR Setup with Patroni (Standalone Deployment)
Configure a Disaster Recovery (DR) replica for ServiceOps using Patroni - the DC site acts as the Patroni leader and the DR site joins as a continuously replicating standby, without HAProxy or automatic failover.
This guide covers standalone deployments where the application and database run on the same machine at both sites. It walks through configuring ETCD, Patroni, application settings, and file sync on both the DC and DR servers.
Architecture Overview
This architecture is for a standalone deployment where the application and database run on the same machine at each site.
Utilities Reference
The following utilities are used in this procedure. Grant each downloaded file execute permissions (chmod 777) before running it.
| Utility | Run On | Purpose |
|---|---|---|
MotadataDCDRPatroniSetup | DC and DR machines | Installs and configures ETCD and Patroni |
MotadataPatroniDCDRConfig | DC and DR machines | Application configuration (located in /opt/HA) |
MotadataPatroniDBConfig | DC and DR machines | Patroni database configuration; creates the replica on DR (located in /opt/HA) |
DCDRFileSync | DC and DR machines | File sync between DC and DR (located in /opt/HA) |
DCDR_SwitchOver | DB machines | Manual DC-DR switchover procedure |
Download MotadataDCDRPatroniSetup from the Download Links page.
Prerequisites
Before proceeding, ensure the following requirements are met:
- System Requirements and Pre-Installation Checklist are satisfied.
- ServiceOps is already installed on both the DC and DR machines in standalone mode.
- The same Linux user (for example,
flotomate) exists on both DC and DR, with the same password. - Ports
22,5432, and8008are open between the DC and DR machines. - Ports
2379,2380,8008, and5432are open on each machine.
If this setup is being configured in an existing environment, take proper backups and snapshots of both machines before proceeding.
Supported Operating Systems
| Operating System | Supported Versions |
|---|---|
| Red Hat | 9.6, 9.8, and 10.2 |
| Ubuntu | 24 and 26 |
Server Information
| Site | Role | Example IP Address |
|---|---|---|
| DC | Standalone (APP + DB), Patroni Node 1 | 172.20.21.23 |
| DR | Standalone (APP + DB), Patroni Node 2 | 172.20.21.19 |
DC Site Configuration
Configure the DC site first, completing all four steps before moving to the DR site.
| Step | Activity | Utility |
|---|---|---|
| 1 | ETCD and Patroni installation | MotadataDCDRPatroniSetup |
| 2 | Application configuration | MotadataPatroniDCDRConfig |
| 3 | Patroni database configuration | MotadataPatroniDBConfig |
| 4 | File sync configuration | DCDRFileSync |
Step 1: ETCD and Patroni Installation
Download
MotadataDCDRPatroniSetup, move it to the DC machine, assign execute permissions, and run it:chmod 777 MotadataDCDRPatroniSetup
./MotadataDCDRPatroniSetupWhen prompted to install and configure ETCD, enter
yes.


- The ETCD installation starts. When prompted to install and configure Patroni, enter
yes.


- Once the packages are installed, when prompted to configure this node as Node 1 or Node 2, enter
1(this is the DC site).


- When prompted for the Node 2 IP address, enter the DR site IP address (for example,
172.20.21.19).


- When prompted for the Patroni port, press Enter to accept the default. When prompted for the ETCD IP address, enter the current machine IP (for example,
172.20.21.23).


Patroni is now installed and configured on the DC site.
Before moving to Step 2, verify that the Patroni service is inactive. If it is active, stop it:
systemctl status patroni
systemctl stop patroni
Step 2: Application Configuration
Move to
/opt/HAand executeMotadataPatroniDCDRConfig:cd /opt/HA
./MotadataPatroniDCDRConfigWhen prompted for the IP address of the database node, enter the current machine IP address.
In this architecture, the application and database run on the same machine. Enter the current machine IP: 172.20.21.23.


- When prompted whether this machine is DC or DR, enter
dc.


The application configuration on the DC site is now complete.

Before moving to Step 3, ensure the motadata_etcd service is active and running:
systemctl status motadata_etcd
systemctl start motadata_etcd
Step 3: Patroni Database Configuration
Move to
/opt/HAand executeMotadataPatroniDBConfig:cd /opt/HA
./MotadataPatroniDBConfigWhen prompted for the Patroni port, press Enter to accept the default.

- The script shows the initial state of the cluster and asks whether to reload the members. Enter
y.

- When asked when the restart should take place, press Enter for now.

- When asked to confirm restarting members, enter
Y.

- When asked whether to restart if the PostgreSQL version is less than the provided one, press Enter.

The Patroni setup on the DC site is now complete.

Step 4: File Sync Configuration
Move to
/opt/HAand executeDCDRFileSync:cd /opt/HA
./DCDRFileSyncWhen prompted for the current machine IP address, enter the DC machine IP (for example,
172.20.21.23).


- When prompted for the server 1 IP address, enter the DR site IP address (for example,
172.20.21.19).


- When prompted for the username, enter the Linux username available on both DC and DR (for example,
flotomate).


- When prompted for the password, enter the password for that user.
The password is not displayed in the terminal for security.

- When prompted for the SSH port, enter
22for the default port, or enter the port in use.


- When prompted for the DB node IP address, enter the current machine IP (app and DB are on the same machine:
172.20.21.23).


- When prompted whether any plugins are installed, enter
yesif ServiceOps has a plugin integration; otherwise enterno.


The DC side file sync configuration is now complete. The full DC site configuration is complete.

DR Site Configuration
Before starting the DR configuration, ensure all four DC site steps are fully complete and that Patroni on the DC site is running as the Leader.
Server Information
| Site | Role | IP Address |
|---|---|---|
| DC | Patroni Node 1 (Leader) | 172.20.21.23 |
| DR | Patroni Node 2 (Replica) | 172.20.21.19 |
Key Differences from DC Configuration
| # | Difference |
|---|---|
| 1 | Configure this node as Node 2 (DC was Node 1). |
| 2 | Patroni on DR points to the ETCD running on the DC site, so the DR database joins the same cluster as a replica. |
| 3 | Enter dr when MotadataPatroniDCDRConfig asks whether the machine is DC or DR. |
| 4 | MotadataPatroniDBConfig must also run on DR - this is what creates the replica. |
| 5 | There is no HAProxy and no automatic failover. The DR node always remains a replica until a manual switchover is performed. |
Pre-checks
Before starting, verify the following:
- The same Linux user (for example,
flotomate) exists on both DC and DR, with the same password. - Ports
22,5432, and8008are open between DC and DR. - Ports
2379,2380,8008, and5432are open on each node. - Backups and snapshots of the DR machine have been taken.
- From the DR machine, verify connectivity to the DC machine on all required ports using
nc -zv. All checks should show succeeded.

Step 1: ETCD and Patroni Installation
On the DR machine (
172.20.21.19), download the sameMotadataDCDRPatroniSetupfile from the Download Links page, provide777permissions, and execute it:chmod 777 MotadataDCDRPatroniSetup
./MotadataDCDRPatroniSetupWhen prompted to install and configure ETCD, enter
yes.


This ETCD instance is installed locally on the DR machine and is kept ready for switchover. It is not joined with the DC ETCD cluster. Patroni on DR will use the DC ETCD, which is specified in a later prompt.
- The ETCD installation starts. When prompted to install and configure Patroni, enter
yes.


- Once the packages are installed, when prompted to configure this node as Node 1 or Node 2, enter
2(this is the DR site).

- When prompted for the Node 1 IP address, enter the DC site IP address (for example,
172.20.21.23).

- When prompted for the PostgreSQL port, press Enter to accept the default (
5432). When prompted for the ETCD IP address, enter the DC site IP address.
For DR, the ETCD IP address is the DC site ETCD, not the current machine. Enter the DC IP: 172.20.21.23.


Patroni is now installed and configured on the DR site. The setup summary shows Node 1 as DC, Node 2 as DR, and ETCD as DC.
Before moving to Step 2, verify that the Patroni service is inactive. If it is active, stop it:
systemctl stop patroni
Step 2: Application Configuration
Move to
/opt/HAon the DR machine and executeMotadataPatroniDCDRConfig:cd /opt/HA
./MotadataPatroniDCDRConfigWhen prompted for the database node IP, enter the current machine (DR) IP address.

In this architecture, the application and database run on the same machine. Enter the current machine IP: 172.20.21.19.

- When prompted whether this machine is DC or DR, enter
dr.

The application configuration on the DR site is now complete. The PostgreSQL service is disabled here because Patroni manages PostgreSQL directly.
Before moving to Step 3, ensure the motadata_etcd service is active and running:
systemctl status motadata_etcd
systemctl start motadata_etcd

Step 3: Patroni Database Configuration (Replica Creation)
Before executing, ensure:
- The
motadata_etcdservice is active on the DR machine. - Patroni on the DC site is running as Leader.
As on the DC site, MotadataPatroniDBConfig must be executed on the DR site as well. This is what creates the replica on the DR server, by joining it to the cluster of the DC site.
Move to
/opt/HAand executeMotadataPatroniDBConfig:cd /opt/HA
./MotadataPatroniDBConfigWhen prompted for the Patroni port, press Enter to accept the default.

- The script shows the current state of the cluster and asks whether to reload the members. Enter
y. When asked when the restart should take place, press Enter for now.

- When asked to confirm restarting members, enter
y. When asked whether to restart if the PostgreSQL version is less than provided, press Enter.

The Patroni setup on the DR site is complete and replica creation starts.

The DR node copies data from the DC leader. Depending on the database size, this can take some time. During this period, the node state may show as creating replica or starting.
Ensure the
patroniservice is active. If it is inactive, start it:systemctl start patroni
Replication Verification
After replica creation is complete, verify replication using the following check:
Cluster status - Run on the DR site. The DR node should show as Replica with state streaming and Lag in MB = 0:
patronictl -c /etc/patroni/config.yml list

The Patroni setup on the DR site is now complete.
Step 4: File Sync Configuration
Move to
/opt/HAand executeDCDRFileSync:cd /opt/HA
./DCDRFileSyncWhen prompted for the current machine IP, enter the DR machine IP (for example,
172.20.21.19).

- When prompted for the server 1 IP, enter the DC site IP address (
172.20.21.23).

- When prompted for the username, enter the same Linux username used on the DC site (for example,
flotomate).
- When prompted for the password, enter the password for that user.
The password is not displayed in the terminal for security.
When prompted for the SSH port, enter
22for the default port, or enter the port in use.When prompted for the DB node IP, enter the current machine IP (app and DB are on the same machine:
172.20.21.19).

- When prompted whether any plugins are installed, enter
yesif ServiceOps has a plugin integration; otherwise enterno.

The DR side file sync configuration and the full DR site configuration are now complete.

Important Notes for the DR Site
Keep the following in mind when operating the DR site:
- No HAProxy: There is no HAProxy in this setup, as no routing is needed.
- No automatic failover: The DR node is always a replica. Any role change must be performed manually using the
DCDR_SwitchOverprocedure. Refer to the Disaster Recovery Operations Guide. - PostgreSQL must stay inactive: The PostgreSQL service is controlled by Patroni on both sites. Stop it if found active:
systemctl stop postgresql - Application services after switchover: Application services are not managed by Patroni and must be started manually on the DR site after a switchover.
Next Steps
After completing the DC-DR setup, you may need to set up additional components depending on your requirements.
- Agent Deployment: To install agents on managed endpoints for monitoring, asset management, and remote control.
- Distributed File Server Installation: For storing and managing attachments and other file-based assets.
- Plugin Server Installation: To extend ServiceOps functionality with custom or third-party integrations.
- DMZ Server Installation: For secure communication with agents and services in a demilitarized zone.
- Poller Installation: To discover assets behind a firewall.