How to back up an SNC Cloud Platform Object Storage bucket

Vedi come Markdown

Find out how to back up an SNC Cloud Platform Object Storage bucket to a remote Object Storage

Objective

You can use a tool such as Rclone to automate backups of your bucket data to a remote Object Storage. The backups can be used to restore your data in the event of a problem.

Requirements

  • An Object Storage bucket
  • Access Keys generated for the source and destination Object Storages
  • Rclone installed
  • S3cmd installed and configured with the Access Keys

Instructions

Info

The Rclone backup tool is used here to describe one possible method for performing backups. Users are free to choose the solution that suits them.

Create a bucket to store the backups

Enter the following command:

$ s3cmd mb s3://backup
Info

To be able to retrieve different versions of a file sent to this bucket, you can enable object versioning for this bucket.

Configure the Rclone source and destination

Create a ~/.config/rclone/rclone.conf configuration file:

[source-s3]
type = s3
provider = Ceph
env_auth = false
access_key_id = CEPH_ACCESS_KEY_SOURCE
secret_access_key = CEPH_SECRET_KEY_SOURCE
endpoint = https://s3-beta.eu-west-rbx-snc.cloud.snc.ovh.net/
region = eu-west-rbx-snc
acl = private
force_path_style = true

[target-s3]
type = s3
provider = Ceph
env_auth = false
access_key_id = CEPH_ACCESS_KEY_TARGET
secret_access_key = CEPH_SECRET_KEY_TARGET
endpoint = https://s3-beta.eu-west-sbg-snc.cloud.snc.ovh.net/
region = eu-west-sbg-snc
acl = private
force_path_style = true

Configure the source-s3 and the target-s3, ideally across two SNC Cloud Platform regions.

Once the environment is configured, the following rclone command can be used to validate the configuration before a backup:

$ rclone sync source-s3:source-bucket target-s3:backup \
  --progress \
  --transfers 16 \
  --checkers 32 \
  --dry-run

Schedule a recurring task

Once the command has been tested, you can schedule a recurring task.

1. Create the systemd service unit:

sudo tee /etc/systemd/system/rclone-backup.service > /dev/null <<'EOF'
[Unit]
Description=Rclone backup
Wants=network-online.target
After=network-online.target

[Service]
User=YOUR_USER
Group=YOUR_GROUP
Environment=RCLONE_CONFIG=PATH_TO_RCLONE_CONFIG/rclone.conf
Type=oneshot
ExecStart=/usr/bin/rclone sync \
  source-s3:source-bucket \
  target-s3:backup \
  --log-file=/var/log/rclone-backup.log \
  --log-level=INFO \
  --transfers=16 \
  --checkers=32
EOF

2. Create the systemd timer unit:

sudo tee /etc/systemd/system/rclone-backup.timer > /dev/null <<'EOF'
[Unit]
Description=Run Rclone backup daily

[Timer]
OnCalendar=daily
Persistent=true
RandomizedDelaySec=15m

[Install]
WantedBy=timers.target
EOF

3. Reload the systemd configuration and enable the timer:

sudo systemctl daemon-reload
sudo systemctl enable --now rclone-backup.timer

4. Check the configuration:

systemctl list-timers --all | grep rclone
sudo systemctl enable --now rclone-backup.service
systemctl status rclone-backup.service
journalctl -u rclone-backup.service

Go further

If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and request a personalised analysis of your project from our Professional Services experts.

Join our community of users.

Questa pagina ti è stata utile?