From c37cebbacbfc55f81458b17fc58dcd1a3f720dc7 Mon Sep 17 00:00:00 2001 From: jeessy2 <6205259+jeessy2@users.noreply.github.com> Date: Fri, 8 Dec 2023 14:52:41 +0800 Subject: [PATCH] feat: using custom s3sync (#99) --- Dockerfile | 2 +- README.md | 28 ++++++++++++++++++---------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 803637c..5dedf21 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ RUN go env -w GO111MODULE=on \ FROM golang:1.20 AS s3sync WORKDIR /src/ -RUN git clone --branch 2.61 https://github.com/larrabee/s3sync.git +RUN git clone https://github.com/jeessy2/s3sync.git WORKDIR /src/s3sync ENV CGO_ENABLED 0 diff --git a/README.md b/README.md index c7fa401..b83cc62 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ ## docker中使用 - 运行docker容器(`/opt/backup-x-files`可替换为主机的目录) - ``` - 默认启动-rclone的配置会保存到/app/backup-x-files/rclone/rclone.conf: + ```shell + # 默认启动rclone的配置会保存到/app/backup-x-files/rclone/rclone.conf: docker run -d --name backup-x --restart=always \ -p 9977:9977 \ @@ -23,7 +23,7 @@ jeessy/backup-x ``` - 登录 http://your_docker_ip:9977 并配置 -- docker容器默认安装default-mysql-client/postgres-client/[s3sync](https://github.com/larrabee/s3sync)/rclone/wget/curl +- docker容器默认安装default-mysql-client/postgres-client/[s3sync](https://github.com/jeessy2/s3sync)/rclone/wget/curl/minio mc ## 系统中使用 - 下载并解压[https://github.com/jeessy2/backup-x/releases](https://github.com/jeessy2/backup-x/releases) @@ -56,15 +56,23 @@ | ---- | ---- | | 备份单个 | mysqldump -h127.0.0.1 -uroot -p#{PWD} name > #{DATE}.sql | | 备份全部 | mysqldump -h127.0.0.1 -uroot -p#{PWD} --all-databases > #{DATE}.sql | - | 还原 | mysql -uroot -p123456 name <2021-11-12_10_29.sql | + | 还原 | mysql -uroot -p123456 name < 2021-11-12_10_29.sql | - 文件 - - | 说明 | 备份脚本 | - | ---- | ---- | - | 备份本地文件到对象存储 [s3sync](https://github.com/larrabee/s3sync) | s3sync --fs-disable-xattr --filter-not-exist --tk #{AccessKey} --ts #{SecretKey} --te #{Endpoint} fs:///opt/test/ s3://#{BucketName}/test/ | - | 备份对象存储到对象存储 [s3sync](https://github.com/larrabee/s3sync) | s3sync --filter-not-exist --sk source_key -ss #{PWD} --se https://s3.source.com --tk #{AccessKey} --ts #{SecretKey} --te #{Endpoint} s3://backup/ s3://#{BucketName}/ | - | 备份本地文件到对象存储 [rclone](https://rclone.org/) | 参考rclone文档。推荐在系统中使用rclone | + - 备份对象存储到对象存储 [s3sync](https://github.com/jeessy2/s3sync) + ```shell + s3sync --filter-not-exist \ + --sk source_key -ss #{PWD} --se https://s3.source.com \ + --tk #{AccessKey} --ts #{SecretKey} --te #{Endpoint} \ + s3://backup/ s3://#{BucketName}/ + ``` + + - 备份本地文件到对象存储 [s3sync](https://github.com/jeessy2/s3sync) + ```shell + s3sync --fs-disable-xattr --filter-not-exist \ + --tk #{AccessKey} --ts #{SecretKey} --te #{Endpoint} \ + fs:///opt/test/ s3://#{BucketName}/test/ + ``` - 变量说明