Disaster Recovery Strategy for MongoDB and VictoriaDB

Prerequisites

  • A minimum of three nodes to enable High Availability are required
  • MongoDB Version 6 is required for this setup

Steps to Deploy Pulse on New Node

  1. Set the MongoDB URI:
Bash
Copy
  1. Enable MongoDB Encryption:
Bash
Copy
  1. Configure Pulse as a Standalone Node:
Bash
Copy
  1. Create necessary directory structure:
Bash
Copy
  1. Move the Pulse executable to the designated directory:
Bash
Copy
  1. Navigate to the Pulse directory:
Bash
Copy
  1. Initialize Pulse:
Bash
Copy
  1. Source the environment variables:
Bash
Copy
  1. Reinitialize Pulse:
Bash
Copy
  1. Retrieve Pulse information:
Bash
Copy
  1. Log in to Pulse Docker:
Bash
Copy

Add Host Entries

Add the following entries to the /etc/hosts file of all the MongoDB nodes, including the Pulse server:

Bash
Copy

Set New MongoDB Nodes

  1. Retrieve the accelo binary and initiate it with the same version tag as the Pulse version on the primary node.
Bash
Copy
  1. Login to the Pulse Registry:
Docker
Copy
  1. Create a new Docker network:
Docker
Copy
  1. Manually download the Mongo image:
Docker
Copy

Configuring the Primary Node (Pulse Server)

  1. Edit Configuration File: In the config/docker/ad-core.yaml file, add the following new fields to the ad-db service section:
  • Add the following fields to the environment block:
Bash
Copy
  • Add the following fields to the volumes block:
Bash
Copy
  • Add the following fields to the extra_hosts block:
Bash
Copy
  1. Run Secondary Data Replica: Replace <Pulse-Server-IP>, <Third-Node-IP>, and <PULSE-VERSION> with the appropriate values and execute:
Bash
Copy
  1. Run Third Data Replica: Replace <Pulse-Server-IP>, <Second-Node-IP>, and <PULSE-VERSION> with the appropriate values and execute:
Bash
Copy
  1. Login to Primary Node's MongoDB Shell & Add Replica Members:
Bash
Copy
  1. Check Replica Status: Run rs.status() to check the status of the replica.
  2. Wait for Stable State: Wait for the MongoDB cluster to stabilize.
  3. Update Mongodb Encrypted URI: Replace the MongoDB encrypted URI in all YAML files under config/docker/ and acceldata_acceluster.conf file with the provided value.

Unencrypted string for reference:

Bash
Copy

VictoriaDB Setup for Backup and Restoration

This is specifically aimed at addressing disk failures; hence, the destination path will reside on a distinct mounted disk.

To setup Victoria database for backup and restore, perform the following:

  1. Navigate to the Acceldata directory.
  2. Fetch the binaries you want to backup and restore using the below command:
Bash
Copy
  1. Extract the contents of the above tar file:
Bash
Copy
  1. Remove unnecessary binaries, except vmbackup and vmrestore.
  2. Execute the shell script:
Bash
Copy
  1. Create a new directory for vmdbbackup as below:
Bash
Copy
  1. Open up access to the ad-vmstorage port by modifying the ad-core.yml file as shown below.
Bash
Copy
  1. Restart vmstorage container using:
Bash
Copy
  1. Execute the following command. This command initiates an incremental backup process. Incremental backups are conducted when the destination (-dst) parameter refers to an existing backup directory. After the initial backup is completed, subsequent backups will always target this existing backup directory.
Bash
Copy
  1. Configure the crontab to execute this task once daily, preferably in the morning:
Bash
Copy

Steps to Restore

To restore from backup, perform the following:

  1. Stop the vmstorage container, if it already running, and run the restore command:
Bash
Copy
  1. Run accelo deploy core
  2. Check the logs of the container using docker logs -f ad-vmstorage_default

Troubleshooting

  • If the backup process is slow, consider adjusting the value of the -concurrency flag to a higher setting. This will boost the number of simultaneous workers responsible for uploading data to the backup storage.
  • If vmrestore or vmbackup encounters an interruption due to a temporary error, simply restart it using the same arguments. The process will resume from where it left off, continuing the restore or backup operation.
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard