11.1. Disaster Recovery Setup Guide¶
Disaster recovery is an automated process to replicate the database of the main server in a remote server.
Requirements:
A pre-configured server as the remote server with a user having sudo rights.
Static IPs for both main and remote servers.
Steps to Initiate Disaster Recovery
Note: For demonstration sake, you would consider IP addresses of main and remote as: Main-server: 192.168.1.111 and Remote-server: 192.168.1.109.
Create authentication SSH-Keygen keys on the main server (192.168.1.111).
Run the following commands.
This generates a pair of public keys.
Create .ssh directory in the remote server (192.168.1.109).
Use ssh from main server to connect to the remote server using [remote server username] and create .ssh directory using the following command.
You will be asked for the password of the remote server’s user account; please type in the password.
Upload generated public keys to remote server (192.168.1.109).
We will upload the new generated public key in the main server on the remote server using the following command.
You will be asked for the password of the remote server’s user account; provide the password.
Set permissions in remote server (192.168.1.109) and a directory where the recovery will happen.
Log in to the remote server and run the following commands.
Login from main (192.168.1.111) to remote (192.168.1.109) without using password.
You can now login to the remote server without a password.
Now we will create a cron job in the main server (192.168.1.111) as the root user.