Nhảy đến nội dung chính

Hướng dẫn Kết Nối Fstorage Với Restic

image-1661138816284.jpg



1. Hướng dẫn cài đặt Restic trên hệ điều hành Centos 

Centos 7

yum install yum-plugin-copr
yum copr enable copart/restic
yum install restic

Centos 8

dnf install epel-release
dnf install restic

Sau khi cài đặt xong kiểm tra restic bằng command

restic -h

[root@FstorageHCM ~]# restic -h

restic is a backup program which allows saving multiple revisions of files and
directories in an encrypted repository stored on different backends.

Usage:
  restic [command]

Available Commands:
  backup        Create a new backup of files and/or directories
  cache         Operate on local cache directories
  cat           Print internal objects to stdout
  check         Check the repository for errors
  copy          Copy snapshots from one repository to another
  diff          Show differences between two snapshots
  dump          Print a backed-up file to stdout
  find          Find a file, a directory or restic IDs
  forget        Remove snapshots from the repository
  generate      Generate manual pages and auto-completion files (bash, fish, zsh)
  help          Help about any command
  init          Initialize a new repository
  key           Manage keys (passwords)
  list          List objects in the repository
  ls            List files in a snapshot
  migrate       Apply migrations
  mount         Mount the repository
  prune         Remove unneeded data from the repository
  rebuild-index Build a new index
  recover       Recover data from the repository
  restore       Extract the data from a snapshot
  self-update   Update the restic binary
  snapshots     List all snapshots
  stats         Scan the repository and show basic statistics
  tag           Modify tags on snapshots
  unlock        Remove locks other processes created
  version       Print version information

Flags:
      --cacert file                file to load root certificates from (default: use system certificates)
      --cache-dir directory        set the cache directory. (default: use system default cache directory)
      --cleanup-cache              auto remove old cache directories
  -h, --help                       help for restic
      --json                       set output mode to JSON for commands that support it
      --key-hint key               key ID of key to try decrypting first (default: $RESTIC_KEY_HINT)
      --limit-download int         limits downloads to a maximum rate in KiB/s. (default: unlimited)
      --limit-upload int           limits uploads to a maximum rate in KiB/s. (default: unlimited)
      --no-cache                   do not use a local cache
      --no-lock                    do not lock the repository, this allows some operations on read-only repositories
  -o, --option key=value           set extended option (key=value, can be specified multiple times)
      --password-command command   shell command to obtain the repository password from (default: $RESTIC_PASSWORD_COMMAND)
  -p, --password-file file         file to read the repository password from (default: $RESTIC_PASSWORD_FILE)
  -q, --quiet                      do not output comprehensive progress report
  -r, --repo repository            repository to backup to or restore from (default: $RESTIC_REPOSITORY)
      --repository-file file       file to read the repository location from (default: $RESTIC_REPOSITORY_FILE)
      --tls-client-cert file       path to a file containing PEM encoded TLS client certificate and private key
  -v, --verbose n                  be verbose (specify multiple times or a level using --verbose=n, max level/times is 3)

Use "restic [command] --help" for more information about a command.

Như vậy là đã cài đặt thành công Restic

2. Cấu hình kết nối Fstorage với Restic

Tạo file env hoặc có thể export trực tiếp bằng các gõ lênh

export AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxx

export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Hoặc tạo file evn

vi .restic_env

Copy nội dung 

export AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxx
export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

chạy command

source  .restic_env

Tạo repository

restic -r s3:https://hcm1.fstorage.vn/multicloud init

image-1661140413407.png

Tạo backup 

restic -r s3:https://hcm1.fstorage.vn/multicloud backup /root

image-1661140064548.png

sau khi backup thành công

image-1661140446713.png

Kiểm tra trên Fstorage

image-1661140619720.png

Đã có thư mục snapshoot

Xem danh sách các snapshoot

restic -r s3:https://hcm1.fstorage.vn/multicloud snapshots

image-1661141156311.png

restore Snapshoot

restic -r s3:https://hcm1.fstorage.vn/multicloud restore ID-Snapshoot --target /path/restore
restic -r s3:https://hcm1.fstorage.vn/multicloud restore 43e7f6a4 --target .

image-1661141253657.png

Xem thêm các command nếu có nhu cầu dùng các actions khác. 

restic -h