Disaster Backup and Restore
Backups
Every 3 hours, a backup of the Porta database is created on a non-primary machine (likely the Arbiter) and stored in the storage/app/Porta-Backups
directory of the porta
container. The backup is a ZIP archive containing an SQL dump of the database.
The backup archive name is in the format machine_type-machine-connection_name-backup-Y-m-d-H-i-s.zip
where Y-m-d-H-i-s
is the date and time the backup was created.
Alternate Setups
- If your Porta On Prem installation is only running a single machine, the backups will be created on this machine.
- If your Porta On Prem installation is running on a single machine with an isolated backup machine, the backups will be created on both machines independently.
QuickRef
- Main machine database has container name
porta-db
- MySQL port
3306
- Replication port
33061
- MySQL port
- Backup machine database has container name
porta-db-2
- MySQL port
3307
- Replication port
33062
- MySQL port
- Arbiter machine database has container name
porta-db-3
- MySQL port
3308
- Replication port
33063
- MySQL port
View database logs
These logs will contain information about replication, and other MySQL logs.
- Helper:
porta-onprem-bundle\porta-helpers\porta-database\view-database-log.bat
View database replication group members as reported by this machine
- Helper:
porta-onprem-bundle\porta-helpers\porta-database\view-group-repl-status.bat
View database replication group members as reported by each machine
- Helper:
porta-onprem-bundle\porta-helpers\porta-database\view-ALL-group-repl-status.bat
Start Group Replication
- Helper:
porta-onprem-bundle\porta-helpers\porta-database\actions\START-repl.bat
Stop Group Replication
- Helper:
porta-onprem-bundle\porta-helpers\porta-database\actions\STOP-repl.bat
Manually Creating a Backup
Porta will create backups automatically on its own, but in the event you want to create a backup manually, such as before performing a destructive replication recovery operation like a reset, you may do so by navigating to porta-onprem-bundle\porta-helpers\porta-database\action
and running create-backup.bat
.
The resulting backup will be located in the porta
container in the /var/www/storage/app/Porta-Backups
directory, with a name like machine_type-machine-connection_name-backup-Y-m-d-H-i-s.zip
.
Recover from Data Loss
Single Node Disaster Recovery (Data Loss)
If only a single member needs to be restored, the broken database should be wiped, rebuilt, rejoin as a new member, and let replication restore it. No need for using backups to recover. See the “! Reset Database !” section in the recovery guide.
Once the database container reset has completed, the database should join the existing group and begin replicating data from the existing databases. Once the replicating has finished, the restoration is complete.
Multiple Node Disaster Recovery (Data Loss)
In most cases, in the event that disaster recovery is needed, most or all databases will be down or offline.
If any database containers on any machines are down, start them so that we can inspect their data and run the recovery steps. Group replication will fail on start but that’s ok; we just need the database to be running in order to access it.
- If possible, manually run the backup tool on each machine.
- See the “Manually Creating a Backup” section above
- Stop each machine’s database container.
- On the machine that contains the backup you would like to use to restore, reset the database container.
- See the “! Reset Database !” section in the recovery guide.
- Once the database container reset has completed, the container should be running and you may now run the restore tool and choose the backup file to restore from. Ideally, this would be the most recent backup among all the machines.
- See the “Restoring from a backup made with the backup tool” section below.
- Once the restore has completed, reset the database containers on the other machines
- See the “! Reset Database !” section in the recovery guide.
- Once the database container reset has completed, each machine’s database should join the existing group and begin replicating data from the restored database.
- Once the database containers have joined the group and finished replicating data, the restoration is complete.
Restoring from a Backup Made with the Backup Tool
Navigate to porta-onprem-bundle\porta-helpers\porta-database\actions
and run restore-from-backup.bat
You will eventually be prompted to choose a backup file to restore with. Enter the number corresponding to the backup you would like to restore and press Enter.
Failover Recovery with Unreal Engine
Note: After the main PX has recovered, to set the PX in use back to the main PX, run the
make px1 primary.bat
batch file located on the desktop of the RX.
Total Machine Failure - Power or Network Loss
Run the RX batch file make px2 primary.bat
located on the desktop of the RX to switch the running Unreal project to the backup PX.
Partial Machine Failure - Service/Performance Loss
Stop Porta’s socket server (porta-socket
) by running stop-porta-socket.bat
in porta-onprem-bundle/porta-helpers/porta-run
on the failed PX.
Run the RX batch file make px2 primary.bat
located on the desktop to switch the running Unreal project to the backup PX.