Backup, Recovery and Replication
Recovery
This section provides a comprehensive guide for setting up recovery between two ZS3Servers.
This setup uses the Blimp UI for deployment, Visual Studio Code for configuration, and MinIO Client (mc) for management.
Whether you're new to ZS3Server or an experienced user, this guide offers detailed instructions for every stage of the process.
Step 1: Deploy ZS3Server1
Go to "Manage Allocations" and select "S3 Setup." and click on create new allocation


Now add blobbers and Click on "Confirm" to add blobbers. Review and confirm the details and pay from the existing balance. Create an allocation and the S3 server setup will open automatically. You will have to create your server instance by adding IP address.

You need to obtain the IP address of your server, which can be provided by your hosting provider or retrieved using the
ifconfigcommand in the terminal. For example, in the server logs, you may see an IP address such as65.109.152.43.

Now add your IP address and click on generate script in Blimp UI. Then enter the password for S3 deployment.


Now copy the script and run it in your server terminal.


Step 2: Deploy ZS3Server2
Go to "Standard Allocation" in the Blimp UI. Create a new allocation and name it
allocation22.

Click on "Confirm" and select the blobbers, then confirm again. This will create a standard allocation.

In the Blimp UI, copy the newly created standard allocation ID.

Go to your server, create a new
.zcn2folder in your home directory ($HOME), and navigate to theblimpfolder. Inside theblimpfolder, create theallocation.txtfile and paste the allocation ID.

Copy the
docker-compose.yml,config.yaml,wallet.jsonandz3server.jsonfiles from the.zcnfolder to the.zcn2folder.


Edit the ports in
docker-compose.yml.Go to line 55 in the.zcn2/docker-compose.ymlfile and note the ports9002:9000. Copy these ports to the.zcn/docker-compose.ymlfile.Now run the following commands to start the Docker containers for
.zcn2folder defined in thedocker-compose.yml:cd ~/.zcn2/ docker-compose up -d

Change the first port in
.zcnfrom9002to9000in docker-compose.yml file, making it9000:9000.

Now run the following commands to start the Docker containers defined in the docker-compose.yml:
cd ~/.zcn/
docker-compose up -d
Step 3: Install MinIO Client (mc)
Follow the installation guide provided in the ZS3Server documentation.
1. macOS Homebrew
Install mc packages using Homebrew
brew install minio/stable/mc
mc --help2. GNU/Linux
Binary Download
wget https://dl.min.io/client/mc/release/linux-amd64/mc
chmod +x mc
./mc --help3. Microsoft Windows
Binary Download
mc.exe --helpStep 4: Create Alias for ZS3Server1
Run the following command to create an alias for zs3server1:
mc alias set zs3server1 http://65.109.152.43:9000 shahnawaz rootroot --api S3v2
Step 5: Create Alias for ZS3Server2
Run the following command to create an alias for zs3server2:
mc alias set zs3server2 http://65.109.152.43:9002 shahnawaz rootroot --api S3v2
Step 6: Create Bucket and Copy Data in ZS3Server1
Create a bucket in
zs3server1withallocation21:mc mb zs3server1/allocation21Verify the bucket:
mc ls zs3server1Copy data to the created bucket:
mc cp ./ zs3server1/allocation21

Step 7: Create Bucket and Copy Data in ZS3Server2
Create a bucket in
zs3server2withallocation22:mc mb zs3server2/allocation22Verify the bucket:
mc ls zs3server2

Step 8: Set Up Replication
Run the following command to create replication between the buckets:
mc mirror zs3server1/allocation21/ zs3server2/allocation22/ --remove watch
Any deletions in bucket1 will automatically replicate in bucket2.
Step 9: Perform Disaster Recovery
Shut down
zs3server1and clean up its deployment.Create a new allocation (
allocation23) using the Blimp UI with a standard allocation.Update the
allocation.txtfile in.zcnwith the newallocation23ID.Set up an alias for the new server:
mc alias set zs3server3 http://65.109.152.43:9000 shahnawaz rootroot --api S3v2Create a new bucket:
mc mb zs3server3/allocation23Restore data to the new allocation:
mc mirror zs3server2/allocation22/ zs3server3/allocation23/

Step 10: Verify Recovery
Check that the files have been recovered to the new allocation:
mc ls zs3server3/allocation3Replication
This section outlines the steps to set up replication between two ZS3Servers.
Replication ensures that data from one server is mirrored to another for backup and redundancy.
Follow the steps below to configure and initiate replication.
Prerequisites
For running two ZS3Servers on the same machine:
Copy the contents of the
.zcnfolder to.zcn2.Update
allocation.txtandzs3server.jsonin.zcn2.Update the
docker-compose.ymlfile to use unique ports.
Ensure both ZS3Servers are configured using MinIO Client aliases:
Alias for the first server (
zcn):mc alias set primary http://<HOST_IP>:9000 root root --api S3v2Alias for the second server (
zcn2):mc alias set secondary http://<HOST_IP>:9002 root root --api S3v2
Step 1: Verify Configuration
Navigate to the
.zcn2folder:cd .zcn2/Open the terminal and run:
ls cat docker-compose.ymlVerify the ports are correctly set to
9002:9000.

Check the standard allocation ID:
cat blimp/allocation.txtCompare this ID with the allocation ID in the Blimp dashboard to ensure consistency.

Step 2: Configure Aliases
Use the MinIO Client (mc) to configure aliases for both servers:
Format:
mc alias set primary http://<HOST_IP>:9000 miniouser miniopassword --api S3v2
mc alias set secondary http://<HOST_IP>:9002 miniouser miniopassword --api S3v2Example:
mc alias set primary http://65.109.152.43:9000 root root --api S3v2
mc alias set secondary http://65.109.152.43:9002 root root --api S3v2Run the alias commands:
mc alias set .zcn http://<HOST_IP>:9000 root root --api S3v2
mc alias set .zcn2 http://<HOST_IP>:9002 root root --api S3v2Step 3: Initiate Replication
Use the following command to start replication:
./mc mirror primary/<BUCKET_PREFIX>/ secondary/<BUCKET_PREFIX>/ --remove --watchReplace
<BUCKET_PREFIX>with the appropriate bucket names.
Example:
./mc mirror zcn/test2-s3/ zcn2/mbtest2 --remove --watch
test2-s3is a folder in the S3 allocation.

mbtest2will be created in the standard allocation onzcn2.

All data from
test2-s3will be replicated intombtest2.
Step 4: Verify Replication
Check the contents of the buckets:
mc ls zcn mc ls zcn2Create new buckets if necessary:
mc mb zcn/test2-s3 mc mb zcn2/mbtest2Confirm that the data is mirrored correctly:
./mc mirror zcn/test2-s3/ zcn2/mbtest2 --remove --watchBackup and Restore with Restic
Use Restic for lightweight, versioned, and secure backups to your ZS3 bucket.
Step 1: Install Restic
sudo apt update -y
sudo apt install restic -y
sudo restic self-updateStep 2: Set Environment Variables
export AWS_ACCESS_KEY_ID=<ACCESS_KEY>
export AWS_SECRET_ACCESS_KEY=<SECRET_KEY>
export RESTIC_REPOSITORY="s3:<ZS3_URL>"Step 3: Initialize the Repository
restic initStep 4: Run a Backup
restic -r s3:<ZS3_URL> --verbose backup <path-to-directory-to-backup>Step 5: List Snapshots
restic snapshotsStep 6: Restore Snapshot
restic restore latest --target ~/ --verboseStep 7: Automate via Crontab (Optional)
Use crontab -e to add periodic backup jobs.
Last updated