restic 是基於golang 編寫的快速,安全,可靠的數據備份工具,使用簡單,同時支持多種后端存儲
支持的后端存儲
- 本地
- sftp (通過ssh)
- http rest server (rest-server restic提供的 )
- s3 (同時支持minio)
- openstack swift
- backblaze b2
- azure blob storage
- google cloud storage
- 以及其他可以通過rclone 訪問的后端存儲
minio 簡單集成使用
- 環境准備
docker-compose, 詳細說明參考https://www.cnblogs.com/rongfengliang/p/12639449.html
version: '3.7'
services:
sidekick:
image: dalongrong/sidekick:v0.1.8
tty: true
ports:
- "80:80"
command: --health-path=/minio/health/ready --address :80 http://minio{1...4}:9000
gateway:
image: minio/minio:RELEASE.2020-04-04T05-39-31Z
command: gateway s3 http://sidekick
environment:
MINIO_ACCESS_KEY: minio
MINIO_SECRET_KEY: minio123
ports:
- "9000:9000"
minio1:
image: minio/minio:RELEASE.2020-04-04T05-39-31Z
volumes:
- data1-1:/data1
- data1-2:/data2
ports:
- "9001:9000"
environment:
MINIO_ACCESS_KEY: minio
MINIO_SECRET_KEY: minio123
MINIO_BROWSER: "off"
command: server http://minio{1...4}/data{1...2}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
minio2:
image: minio/minio:RELEASE.2020-04-04T05-39-31Z
volumes:
- data2-1:/data1
- data2-2:/data2
ports:
- "9002:9000"
environment:
MINIO_ACCESS_KEY: minio
MINIO_SECRET_KEY: minio123
MINIO_BROWSER: "off"
command: server http://minio{1...4}/data{1...2}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
minio3:
image: minio/minio:RELEASE.2020-04-04T05-39-31Z
volumes:
- data3-1:/data1
- data3-2:/data2
ports:
- "9003:9000"
environment:
MINIO_ACCESS_KEY: minio
MINIO_SECRET_KEY: minio123
MINIO_BROWSER: "off"
command: server http://minio{1...4}/data{1...2}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
minio4:
image: minio/minio:RELEASE.2020-04-04T05-39-31Z
volumes:
- data4-1:/data1
- data4-2:/data2
ports:
- "9004:9000"
environment:
MINIO_ACCESS_KEY: minio
MINIO_SECRET_KEY: minio123
MINIO_BROWSER: "off"
command: server http://minio{1...4}/data{1...2}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
volumes:
data1-1:
data1-2:
data2-1:
data2-2:
data3-1:
data3-2:
data4-1:
data4-2:
- 安裝restic
參考https://github.com/restic/restic/releases - 配置s3環境變量
export AWS_ACCESS_KEY_ID=minio
export AWS_SECRET_ACCESS_KEY=minio123
- 初始化restic
restic -r s3:http://localhost/backup init
效果
- 進行數據備份操作
restic -r s3:http://localhost/backup backup ./
效果
- 查看備份
restic -r s3:http://localhost/backup snapshots
效果
- 查看備份內容
restic -r s3:http://localhost/backup ls 875a2a32
效果
- 數據恢復
restic -r s3:http://localhost/backup restore 875a2a32 -t ./
效果
說明
restic 是一個很不錯的數據備份方案,rclone是一個不錯的數據同步方案,以及minio作為數據存儲,集成在一起真的很不錯
參考資料
https://restic.readthedocs.io/en/stable/
https://github.com/restic/restic
https://github.com/rongfengliang/minio-cluster-sidekick-learning