SAFR Server Backup and Restore

The backup process backs up the entire SAFR Server, including the various databases, configuration files, images, and objects, to a single backup file at a location of your choosing. The restore process restores all the SAFR Server data to any computer that meets the minimum system requirements. Note that the target computer of the restore process doesn't need to have the same IP address as the original computer.

Command Line Arguments

Both the backup and restore commands have some useful optional arguments that you can use when invoking the commands.

On Windows

Windows Backup

Open a command line console with administrative privileges.

command path: C:\Program Files\RealNetworks\SAFR\bin

run command: python backup.py

The backup command generates a backup file at the path C:\Program Files\RealNetworks\SAFR-backups\SAFR-backup-YYYYMMDD-HHMMSS.tgz

Windows Restore

Open a command line console with administrative privileges.

command path: C:\Program Files\RealNetworks\SAFR\bin

run command: python restore.py BACKUPFILENAME

Press Y when asked, "Are you sure? (Yy/Nn)"

You'll receive the following message when the restore is complete:

Windows Auto Daily Backup

To use the Windows Task Scheduler to create a daily database backup, do the following:

  1. Run the Windows Task Scheduler as an administrator. The Task Scheduler window will be displayed.

  2. In the Actions pane, click Create Basic Task.

  3. In the wizard's Name field, provide a name for the task. (e.g. SAFR DB Daily Backup) Click Next.

  4. Under Task Trigger, select the Daily option, and click Next.

  5. Set the date and time for when you want the task to run, and enter 1 in the Recur field. Click Next.

  6. Using a text editor, create a .bat file called SAFR DB Daily Backup. Edit the .bat file, add the following commands, and then save the file.

    @echo off
    cd C:\Program Files\RealNetworks\SAFR\bin
    start python backup.py
  7. Under Action, select the Start a Program option, and click Next.

  8. Click Browse and select the SAFR DB Daily Backup.bat file you created in Step 6. Click Next.

  9. Under Summary, select Open the Properties dialog for this task when I click Finish, and click Finish.

  10. In Properties, do the following:

    1. Select the Run whether user is logged on or not option.
    2. Select the Run with highest privileges option.
    3. Click Change User or Groups.
    4. Enter the object name to select in the field. (e.g. DB-USERMACHINE-T/username) Click Check Name and click OK.
    5. Enter your username and password and click OK.

Once this procedure is completed, you can find the task in the Task Scheduler Library. Check History to view the task events. You can find the daily backup file in the path shown in the SAFR DB Daily Backup.bat file.

On Linux

Linux Backup

command path: /opt/RealNetworks/SAFR/bin

run command: sudo python backup.py

The backup command generates a backup file at the path /opt/RealNetworks/SAFR-backups/SAFR-backup-YYYYMMDD-HHMMSS.tgz

You'll receive the following message when the backup is complete:

Linux Restore

command path: /opt/RealNetworks/SAFR/bin

run command: sudo python restore.py BACKUPFILENAME

Press Y when asked, "Are you sure? (Yy/Nn)"

Linux Auto Daily Backup

Script:

#backup at 1 a.m every day
0 1 * * * /bin/sh /opt/RealNetworks/SAFR/bin/backup
# remove 7 days before backup files at each sunday 0:30 a.m
30 0 * * 0 find /opt/RealNetworks/SAFR-backups/ -mtime +3 -name "*.tgz" -exec rm -rf {} \;

Result:

root@SAFRDemo:/opt/RealNetworks/SAFR/backups# ls -l
total 6547396
-rw-r----- 1 safr safr 837380012 Sep 11 01:00 SAFR-backup-20190911-010001.tgz
-rw-r----- 1 safr safr 837423761 Sep 12 01:00 SAFR-backup-20190912-010001.tgz
-rw-r----- 1 safr safr 837443430 Sep 13 01:00 SAFR-backup-20190913-010001.tgz
-rw-r----- 1 safr safr 837450675 Sep 14 01:00 SAFR-backup-20190914-010001.tgz
-rw-r----- 1 safr safr 837588424 Sep 15 01:00 SAFR-backup-20190915-010001.tgz
-rw-r----- 1 safr safr 837587472 Sep 16 01:00 SAFR-backup-20190916-010001.tgz
-rw-r----- 1 safr safr 839439035 Sep 17 01:00 SAFR-backup-20190917-010001.tgz

On macOS

macOS Backup

command path: /Library/RealNetworks/SAFR/bin

run command: sudo python backup.py

The backup command generates a backup file at the path /opt/RealNetworks/SAFR-backups/SAFR-backup-YYYYMMDD-HHMMSS.tgz

You'll receive the following message when the backup is complete:

macOS Restore

command path: /Library/RealNetworks/SAFR/bin

run command: sudo python restore.py BACKUPFILENAME

Press Y when asked, "Are you sure? (Yy/Nn)"

You'll receive the following message when the restore is complete:

On Server Clusters

The backup and restore process should only be run on the Primary Server of a SAFR Server cluster. Data restored on the primary will automatically be synchronized to the SAFR Secondary Servers after the SAFR Primary Server is restored.

Server Cluster Restore

To restore a SAFR Server cluster,

  1. Uninstall SAFR Platform from the machines which you'll use for your SAFR Server cluster.
  2. Install the same version of SAFR Platform as your backup onto all the machines of your SAFR Server cluster. Note: Do NOT log into any of the installed platforms yet.
  3. Run the restore script on one of the machines. This machine is now your Primary Server.

See Also