Use Case - Backup and Restore

Use your ZS3 buckets as backup storage space for your data

After deploying your S3 server, you can use Restic to be able to use your bucket as backup storage space for your data, with better carbon footprint, security and performance.

Setup restic to use your bucket for backup

Here are the steps to use your ZS3 buckets for backup using Restic:

  1. Deploy zs3server as mentioned in this page. Once deployed, you can find your URL, access key and secret key in the "Use CLI" section in Blimp's S3 operations page, as shown in the image below.

Fig1: URL, secret and access keys in Using CLI section

Example of this command (with the credentials part in double square parts)

curl -X GET [[https://blimpsogec.zus.network]]/minioclient/?action=createBucket&[[accessKey=devyetii&secretAccessKey=Admin@123]]

In this example:

  • The URL: https://blimpsogec.zus.network

  • The Access Key: devyetii

  • The secret key: Admin@123

  1. Connect to the machine you'll be using for backup/restore. This can be your local machine, or any other remote machine that you have. If it's a remote machine, then you can use SSH to connect to it as follows:

ssh <user>@<ip>
  1. Install Restic on your machine. Provided below are steps to install Restic on Ubuntu machine. For other Linux distros or other OSs, check Restic Installation Guide.

sudo apt update -y
sudo apt install restic -y
sudo restic self-update
  1. Prepare you environment variables as follows:

export AWS_ACCESS_KEY_ID=<your-access-key-from-step2>
export AWS_SECRET_ACCESS_KEY=<your-secret-key-from-step2>
export RESTIC_REPOSITORY="s3:<your-zs3server-url-from-step2>"

You should replace the placeholders in the command (<your-access-key-from-step2>, <your-secret-key-from-step2> and <your-url-from-step2>) with the corresponding values from Step 2.

  1. Initialize your Restic repository as follows:

restic init
  1. After the repository is initialized, we're ready to make a backup. Find a local directory with data files to backup. Use below command to start back up.

restic -r s3:<your-zs3server-url-from-step2> --verbose backup <path-to-directory-to-backup>
    

You should replace the command placeholders (<your-zs3server-url-from-step2>, <path-to-directory-to-backup> ) with corresponding values.

Now, a new backup snapshot of this directory is created and saved to the Restic repository. You can add this command to your crontab file to run the backup periodically.

  1. You can also list all of your snapshots with the following command:

restic snapshots
  1. To restore the latest snapshot to a specific target you can use the following command:

restic restore latest --target ~/ --verbose

For more sets of restic commands, you can refer to the official Restic Backup docs.

Last updated