Skip to content

Complete Reinstall of MiaRec Cluster (All-In-One and Decoupled)

In the event that an entire cluster, all-in-one or decoupled, is lost and needs to be reinstalled, the following steps can be executed to restore data:

  • Install all the software on new servers

  • Restore database (configuration, call metadata)

  • Restore audio files

  • Regenerate license keys

Prepare Ansible Controller Host

This process prepares the ansible controller to provision the MiaRec Cluster. The ansible controller can be a local machine, the all-in-one MiaRec instance, or one of the instances in a decoupled MiaRec cluster (usually a database instance).

The process is described here

Prepare Target Hosts

This process prepares host(s) to be provisioned. Execute this process on all host(s) in the MiaRec Cluster.

The process is described here

Configure Deployment

This process prepares the ansible inventory which defines what and how the cluster is provisioned. Execute this process on the ansible controller.

Info

MiaRec application versions are defined in this step. For successful restoration of the database in later steps, these versions must be the same or newer as the backed-up cluster.

The process is described here

Execute prepare-hosts.yml playbook to provision the server(s)

This playbook installs all the required software dependencies for MiaRec applications, including the creation of the miarecdb database that can be a target for data restoration in the next step.

Execute Playbook

Execute these commands from the ansible controller.

cd /opt/ansible-miarec

ansible-playbook -i hosts prepare-hosts.yml

Verification

Confirm satisfactory completion with zero items unreachable or failed.

PLAY RECAP ********************************************************************
...
miarec                :  ok=79   changed=42   unreachable=0    failed=0

Result

All host(s) will be provisioned with supporting software such as Redis, Python, and PostgreSQL. The database miarecdb will be created, however, there will be no data present in the database.

Restore Database with pg_restore utility

The following commands must be executed from the Database instance. In an all-in-one configuration, this will be a single server instance, in a decoupled architecture, this will be the instance listed in the [db] group in the ansible inventory.

Execute pg_restore from db instance

sudo -iu postgres pg_restore -d miarecdb /path/to/backup_file

Let's break down those options:

  • suo -iu postgres instructs the shell to execute the trailing command to run as user postgres, this is required for authentication.

  • pg_restore calls pg_restore utility.

  • -d miarecdb connects to database miarecdb and restores directly into the database, this should always be miarecdb.

  • /path/to/backup_file - the file to restore from, keep in mind this needs to be accessible by the postgres user account. Change the file permissions or owner of the backup file if necessary using chmod and chown utilities.

Verification

The database will be restored, you can verify it by querying the database.

sudo -iu postgres psql -d miarecdb -c "SELECT COUNT(*) FROM calls;"

The count of all calls in the database should be returned.

[centos@miarecdb ~]$ sudo -iu postgres psql -d miarecdb -c "SELECT COUNT(*) FROM calls;"
 count 
-------
    34
(1 row)

Run setup-miarec.yml playbook to install the MiaRec software

This playbook installs the MiaRec applications. This should be executed after the database is successfully restored.

Note

MiaRec application versions specified in the ansible inventory must be the same or newer as the previously backed up cluster.

Execute Playbook

Execute these commands from the ansible controller.

cd /opt/ansible-miarec

ansible-playbook -i hosts setup-miarec.yml

Verification

Confirm satisfactory completion with zero items unreachable or failed.

PLAY RECAP ********************************************************************
...
miarec                :  ok=79   changed=42   unreachable=0    failed=0

Result

You should now be able to access the new instance of MiaRec using the previously configured admin account, all configuration and call recordings should be accessible. Audio files may still need to be restored separately depending on an initial storage configuration for audio files.

Note

Depending on the type of recovery, License keys will need to be regenerated, contact Miarec support for that.

Restore License Keys

License keys are stored as database objects. However, with a complete reinstall, previous keys may become invalid on new hardware and new keys must be generated.

Contact MiaRec support for assistance.

Restore Audio Files

When Relocate Audio Files job is used to move files to external storage, there is no need to follow the restoration steps. Audio files should be accessible on the same external storage device.

If the files were stored locally on the recording server, then copy the audio files from your existing backup location to the same location as was used previously on the original server.