Partial Reinstall, Database Component Only (Decoupled configuration)
In the event that a database becomes unavailable or corrupt, the following steps can be executed to reinstall the database instance and accomplish the following:
-
Reinstall the Database component
-
Restore Database (configuration, call metadata)
Prepare Ansible Controller Host
This might not be needed if the ansible controller
was not affected.
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.
The process is described here
Prepare Target Hosts
This process prepares the database host to be provisioned.
The process is described here 2. Prepare target hosts
Configure Deployment
This process prepares the ansible inventory which defines how the
cluster is provisioned. In this scenario, likely the only update will be
to the db
instance IP address, where a database service should be
redeployed.
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 previously backed-up cluster.
Execute this process on the ansible controller
.
The process is described here 3. Configure Deployment
Execute prepare-hosts.yml
playbook to provision the server
This playbook installs all the required software dependencies for MiaRec
applications, including the creation of an empty miarecdb
database.
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
The database instance will be provisioned with supporting software
such as redis
, pgbouncer
and postgresql
. The postgres
user will be
created and the database miarecdb
will be created, however, there will be
no data present.
Restore Database with pg_restore
utility
The following commands need to be executed from the Database Instance.
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:
-
sudo -iu postgres
instructs the shell to execute the trailing command to run as userpostgres
, this is required for authentication. -
pg_restore
calls pg_restore utility. -
-d miarecdb
connects to databasemiarecdb
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 thepostgres
user account.
Verification
The database will be restored, you can verify 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 -u postgres psql -d miarecdb -c "SELECT COUNT(*) FROM calls;"
count
-------
34
(1 row)
Run setup-miarec.yml
playbook to modify the existing MiaRec Applications
This playbook installs and/or updates MiaRec applications. In this case,
the only action that will be applied updates to the miarecweb
and
miarec
configuration INI files, directing the applications to the new
database IP address.
This should be executed only after the database is successfully restored.
Info
MiaRec Application versions specified in the ansible inventory must be the same or newer as the previously backed up cluster.
Execute Playbook
Execute this command 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 MiaRec cluster using the previously configured admin account, all configuration and call recordings should be accessible.
Restore License Keys
No Action is required. License keys are stored as database objects, and since the recorder was not changed, license keys are still valid.
Restore Audio Files
No Action is required, since the recorder was not modified, audio files should be intact.