Bạn cần tìm gì?
< Tất cả chủ đề
In

Hướng Dẫn Backup Dữ Liệu Từ Các Thiết Bị Windows, Linux Lên Fstorage

1. Giới Thiệu

Backup là hành động sao chép (sao lưu) lại toàn bộ nội dung của dữ liệu gốc, tạo ra bản sao của một hoặc nhiều tập tin, dữ liệu trong máy tính, chương trình, hoặc toàn bộ ổ đĩa được lưu trữ an toàn ở một nơi khác có thể được sử dụng trong trường hợp bản gốc bị mất, bị hư hỏng, bị phá hủy, bị nhiễm virus, bị mất máy…

2. Hướng Dẫn Backup Dữ Liệu Từ Windows

2.1  Sử dụng tool Cloudberry Backup

Download CloudBerry Backup tại https://www.msp360.com/backup/

Cài đặt CloudBerry Backup

image-1660820406652.png

image-1660820432687.png

image-1660820456102.png

image-1660820545439.png
Thiết lập kết nối Fstorage.

image-1660820703801.png

image-1660820737649.png

Chọn S3 Compatible 

image-1660820780538.png

Thiết lập các thông tin liên của Fstorage

image-1660821265623.png

Đặt tên và thiết lập các tùy chỉnh.

image-1660821392632.png

 Tạo Plan Backup 

image-1660821461946.png

image-1660821492905.png

Chọn phân vùng hoặc Foder cần backup lên Fstorage

image-1660821582470.png

Tùy chọn các filter

image-1660821622801.png

Chọn mã hóa dữ (Bản PRO mới có tùy chọn này)

image-1660821742530.png

Lập lịch chạy backup

image-1660821823323.png

Điều chỉnh các rule Backup

Xem thêm tại https://help.msp360.com/cloudberry-backup/backup/about-backups/gfs/gfs

Thiết lập email để nhận thông báo.

image-1660821965338.png

Xem lại các thiết lập

image-1660822008360.png

Chạy backup

image-1660822210680.png

Tiến trình backup đang chạy

image-1660822249441.png
 Tạo Plan Resore

Chuyển sang Tab Restore Plans

image-1660822363554.png

Tạo New Plan

image-1660822389607.png

Chọn tài khoản cần Restore

image-1660822424533.png

Tùy chọn Restore Plan. Chạy 1 lần hoặc chạy theo lịch

image-1660822514948.png

Chọn loại dữ liệu Restore

image-1660822545548.png

Chọn thời gian Backup

image-1660822576848.png

Chọn version cần restore

image-1660822606363.png

Chọn file hoặc thư mục muốn restore

image-1660822638364.png

Chọn nơi lưu dữ liệu được restore

image-1660822719902.png

Lập lịch chạy restore

image-1660822760897.png

Tùy chọn Action

image-1660822800313.png

Thiết lập email nhận thông báo

image-1660822827172.png

Xem lại các cấu hình

image-1660822860834.png

Kết thúc quá trình thiết lập Plan restore

image-1660822909472.png

Chạy Restore

image-1660822975864.png

Tiến trình restore

image-1660823001194.png

Như vậy là chúng ta đã hoàn thành việc kết nối Fstorage cũng như tạo các Plan backup và Restore trên CloudBerry Backup

Ngoài ra có thể dùng một số tool khác. xem thêm (https://docs.fstorage.vn/books/huong-dan-ket-noi-windows-voi-fstorage)

2.2 Sử dụng Restic

Cài đặt Restic trên windows

Để cài đặt được Restic trên windows cần phải cài scoop

Mở Windows Powershell

Chạy lệnh trên Powershell

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

Chọn Y

Chạy tiếp lệnh

irm get.scoop.sh | iex

Kiểm tra xem scoop đã cài xong chưa

Gõ lên scoop

PS C:UsersTai Cao> scoop                                                                                                                                                                     Usage: scoop <command> [<args>]

Available commands are listed below.

Type ‘scoop help <command>’ to get more help for a specific command.

Command    Summary
——-    ——-
alias      Manage scoop aliases
bucket     Manage Scoop buckets
cache      Show or clear the download cache
cat        Show content of specified manifest. If available, `bat` will be used to pretty-print the JSON.
checkup    Check for potential problems
cleanup    Cleanup apps by removing old versions
config     Get or set configuration values
create     Create a custom app manifest
depends    List dependencies for an app, in the order they’ll be installed
download   Download apps in the cache folder and verify hashes
export     Exports installed apps, buckets (and optionally configs) in JSON format
help       Show help for a command
hold       Hold an app to disable updates
home       Opens the app homepage
import     Imports apps, buckets and configs from a Scoopfile in JSON format
info       Display information about an app
install    Install apps
list       List installed apps
prefix     Returns the path to the specified app
reset      Reset an app to resolve conflicts
search     Search available apps
shim       Manipulate Scoop shims
status     Show status and check for new app versions
unhold     Unhold an app to enable updates
uninstall  Uninstall an app
update     Update apps, or Scoop itself
virustotal Look for app’s hash or url on virustotal.com
which      Locate a shim/executable (similar to ‘which’ on Linux)

Cài đặt Restic

Gõ lệnh

scoop install restic

image-1661161674007.png

Kiểm tra xem Restic đã cài đặt thành công hay chưa

Gõ lệnh

restic -h

PS C:UsersTai Cao>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
  prune         Remove unneeded data from the repository
  rebuild-index Build a new index
  recover       Recover data from the repository not referenced by snapshots
  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
      –insecure-tls               skip TLS certificate verification when connecting to the repo (insecure)
      –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.

Kết nối Fstorage với Restic

Tạo file credentials trong C:Usersusrname.aws

image-1661161970583.png

Nội dung file

[default]
aws_access_key_id = xxxxxxxxxxxxxxxxxxxxxxx
aws_secret_access_key = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

image-1661162117847.png

 Các thao tác với Restic

Tạo repository

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

Nhập mật khẩu cho repo

image-1661162269909.png

Tạo backup

restic -r s3:https://hcm1.fstorage.vn/multicloud backup D:64bit

image-1661162320400.png

Kiểm tra Snapshots

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

Nhập mật khẩu (mật khẩu vừa tạo lúc init tạo repo)

image-1661162424572.png

Restore Snapshots

restic -r s3:https://hcm1.fstorage.vn/multicloud restore 8bf7a3a5 –target D:

(8bf7a3a5 là id snapshots)

image-1661163347121.png

Ngoài Restic có thể dùng Rclone hoặc AWS CLI đều được.

3. Hướng Dẫn Backup Dữ Liệu Từ Linux

3.1 Hướng dẫn backup với Restic

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

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

3.2 Backup Linux với Veeam Agent.

B1: Mount 3 Bucket  (Xem hướng dẫn Kết nối S3 Bucket với server bằng S3FS https://docs.fstorage.vn/books/huong-dan-ket-noi-linux-voi-fstorage/page/huong-dan-ket-noi-fstorage-voi-s3fs)

B2: Cấu hình Veeam.

Cài đặt Veeam Agent.
yum install -y veeam

Cấu hình Veeam

Sau khi cài đặt hoàn thành gõ command

veeam

Accept license → Click Next

Next

Click Finish

Tạo Job backup

Bấm C

Chọn nơi chứa file backup

Chọn mount point được mount từ S3 Bucket trên server

Chọn thời gian băt đâu chạy backup

Finish để hoàn tất việc thiết lập Job backup

Sau khi tạo xong sẽ thấy có 1 Job đang chạy

Bấm Esc để thoát khỏi màn hình Veeam.

Kiểm tra xem có file backup chưa.

Mục lục