# brudi
When it comes to backup-creation there are several solutions to use.
In general everybody's doing some sort of `dump` or `tar` and backing up the results incremental with [`restic`](https://github.com/restic/restic) or similar programs.
This is why `brudi` was born. `brudi` supports several backup-methods and is configurable by a simple `yaml` file.
The advantage of `brudi` is, that you can create a backup of a source of your choice and save it with `restic` afterwards in one step.
Under the hood, `brudi` uses the given binaries like `mysqldump`, `mongodump`, `pg_dump`, `tar` or `restic`.
Using `brudi` will save you from finding yourself writing bash-scripts to create your backups.
Besides creating backups, `brudi` can also be used to restore your data from backup in an emergency.
## Table of contents
- [Usage](#usage)
- [CLI](#cli)
- [Docker](#docker)
- [Configuration](#configuration)
- [Sources](#sources)
- [Tar](#tar)
- [MySQLDump](#mysqldump)
- [MongoDump](#mongodump)
- [PgDump](#pgdump)
- [Limitations](#limitations)
- [Redis](#redis)
- [Restic](#restic)
- [Forget](#forget)
- [Sensitive data: Environment variables](#sensitive-data-environment-variables)
- [Gzip support for binaries without native gzip support](#gzip-support-for-binaries-without-native-gzip-support)
- [Restoring from backup](#restoring-from-backup)
- [TarRestore](#tarrestore)
- [MongoRestore](#mongorestore)
- [MySQLRestore](#mysqlrestore)
- [PgRestore](#pgrestore)
- [Restore using pg_restore](#restore-using-pg_restore)
- [Restore using psql](#restore-using-psql)
- [Restoring using restic](#restoring-using-restic)
- [Featurestate](#featurestate)
- [Source backup methods](#source-backup-methods)
- [Restore backup methods](#restore-backup-methods)
- [Incremental backup of the source backups](#incremental-backup-of-the-source-backups)
## Usage
### CLI
In order to use the `brudi`-binary on your local machine or a remote server of your choice, ensure you have the required tools installed.
- `mongodump` (required when running `brudi mongodump`)
- `mysqldump` (required when running `brudi mysqldump`)
- `tar` (required when running `brudi tar`)
- `redis-cli` (required when running `brudi redisdump`)
- `restic` (required when running `brudi --restic`)
```shell
$ brudi --help
Easy, incremental and encrypted backup creation for different backends (file, mongoDB, mysql, etc.)
After creating your desired tar- or dump-file, brudi backs up the result with restic - if you want to
Usage:
brudi [command]
Available Commands:
help Help about any command
mongodump Creates a mongodump of your desired server
mongorestore Restores a server from a mongodump
mysqldump Creates a mysqldump of your desired server
mysqlrestore Restores a database from an sqldump
pgdump Creates a pg_dump of your desired postgresql-server
pgrestore Restores a database from a pgdump using pg_restore
psql Restores a database from a plain-text pgdump using psql
redisdump Creates an rdb dump of your desired server
tar Creates a tar archive of your desired
tarrestore Restores files from a tar archive
version Print the version number of brudi
Flags:
--cleanup cleanup backup files afterwards
-c, --config string config file (default is ${HOME}/.brudi.yaml)
-h, --help help for brudi
--restic backup result with 'restic backup'
--restic-forget executes 'restic forget' after backing up things with restic
--version version for brudi
Use "brudi [command] --help" for more information about a command.
```
### Docker
In case you don't want to install additional tools, you can also use `brudi` inside docker:
`docker run --rm -v ${HOME}/.brudi.yml:/home/brudi/.brudi.yml quay.io/mittwald/brudi mongodump --restic --cleanup`
The docker-image comes with all required binaries.
### Configuration
As already mentioned, `brudi` is configured via `.yaml`. The default path for this file is `${HOME}/.brudi.yaml`, but it's adjustable via `-c` or `--config`.
The config file itself can include environment-variables via `go-template`:
```yaml
restic:
global:
flags:
repo: "{{ .Env.RESTIC_REPOSITORY }}"
```
Since the configuration provided by the `.yaml`-file is mapped to the corresponding CLI-flags, you can adjust literally every parameter of your source backup.
Therefore you can simply refer to the official documentation for explanations on the available flags:
- [`restic`](https://restic.readthedocs.io/en/latest/manual_rest.html)
- [`tar`](https://www.gnu.org/software/tar/manual/html_section/tar_22.html)
- [`mongodump`](https://docs.mongodb.com/manual/reference/program/mongodump/#options)
- [`mysqldump`](https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html#mysqldump-option-summary)
- [`pg_dump`](https://www.postgresql.org/docs/12/app-pgdump.html)
Every source has a an `additionalArgs`-key which's value is an array of strings. The value of this key is appended to the command, generated by `brudi`.
Even though `brudi` should support all cli-flags to be configured via the `.yaml`-file, there may be flags which are not.
In this case, use the `additionalArgs`-key.
It is also possible to provide more than one configuration file, for example `-c mongodump.yaml -c restic.yaml`. These configs get merged at runtime.
If available, the default config will always be laoded first and then overwritten with any values from user-specified files.
In case the same config file has been provided more than once, only the first instance will be taken into account.
#### Sources
##### Tar
```yaml
tar:
options:
flags:
create: true
gzip: true
file: /tmp/test.tar.gz
additionalArgs: []
paths:
- /tmp/testfile
hostName: autoGeneratedIfEmpty
```
Running: `brudi tar -c ${HOME}/.brudi.yml --cleanup`
Becomes the following command:
`tar -c -z -f /tmp/test.tar.gz /tmp/testfile`
All available flags to be set in the `.yaml`-configuration can be found [here](pkg/source/tar/cli.go#L7).
##### MySQLDump
```yaml
mysqldump:
options:
flags:
host: 127.0.0.1
port: 3306
password: mysqlroot
user: root
opt: true
allDatabases: true
resultFile: /tmp/test.sqldump
additionalArgs: []
```
Running: `brudi mysqldump -c ${HOME}/.brudi.yml --cleanup`
Becomes the following command:
`mysqldump --all-databases --host=127.0.0.1 --opt --password=mysqlroot --port=3306 --result-file=/tmp/test.sqldump --user=root`
All available flags to be set in the `.yaml`-configuration can be found [here](pkg/source/mysqldump/cli.go#L7).
##### MongoDump
```yaml
mongodump:
options:
flags:
host: 127.0.0.1
port: 27017
username: root
password: mongodbroot
gzip: true
archive: /tmp/dump.tar.gz
additionalArgs: []
```
Running: `brudi mongodump -c ${HOME}/.brudi.yml --cleanup`
Becomes the following command:
`mongodump --host=127.0.0.1 --port=27017 --username=root --password=mongodbroot --gzip --archive=/tmp/dump.tar.gz`
All available flags to be set in the `.yaml`-configuration can be found [here](pkg/source/mongodump/cli.go#L7).
##### PgDump
```yaml
pgdump:
options:
flags:
host: 127.0.0.1
port: 5432
password: postgresroot
username: postgresuser
dbName: postgres
file: /tmp/postgres.dump
additionalArgs: []
```
Running: `brudi pgdump -c ${HOME}/.brudi.yml --cleanup`
Becomes the following command:
`pg_dump --file=/tmp/postgres.dump --dbname=postgres --host=127.0.0.1 --port=5432 --username=postgresuser`
All available flags to be set in the `.yaml`-configuration can be found [here](pkg/source/pgdump/cli.go#L7).
###### Limitations
U
没有合适的资源?快使用搜索试试~ 我知道了~
为不同后端(文件、mongoDB、mysql、postgres等)创建恢复简单、增量和加密的备份_Go_Makefile.zip
共102个文件
go:70个
yaml:19个
yml:6个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 9 浏览量
2023-04-28
13:44:04
上传
评论
收藏 102KB ZIP 举报
温馨提示
为不同后端(文件、mongoDB、mysql、postgres等)创建恢复简单、增量和加密的备份_Go_Makefile.zip
资源推荐
资源详情
资源评论
收起资源包目录
为不同后端(文件、mongoDB、mysql、postgres等)创建恢复简单、增量和加密的备份_Go_Makefile.zip (102个子文件)
Dockerfile 865B
.gitignore 63B
postgres_test.go 15KB
mysql_test.go 12KB
redisdump_test.go 11KB
cli.go 10KB
mongodb_test.go 10KB
commands.go 10KB
types.go 9KB
cli.go 7KB
cli.go 5KB
cli_test.go 4KB
initialize_from_viper.go 4KB
tar_test.go 3KB
cli.go 3KB
cli.go 3KB
initialize_from_viper_test.go 3KB
cli.go 3KB
config_handler.go 3KB
client.go 2KB
testcommons.go 2KB
merge_configs_test.go 2KB
cli.go 2KB
root.go 2KB
restore.go 2KB
validate_test.go 2KB
backup.go 2KB
cli.go 2KB
cli.go 2KB
cleanup.go 2KB
backend_config_based.go 2KB
backend_config_based.go 2KB
backend_config_based.go 1KB
backend_config_based.go 1KB
backend_config_based.go 1KB
backend_config_based.go 1KB
backend_config_based.go 1KB
backend_config_based.go 1KB
vars_test.go 1KB
backend_config_based.go 1KB
backend_config_based.go 1022B
config.go 777B
config.go 771B
ensure_env.go 697B
mongodump.go 653B
redisdump.go 653B
mysqldump.go 652B
mongorestore.go 652B
mysqlrestore.go 651B
pgdump.go 647B
tarrestore.go 646B
pgrestore.go 626B
cli.go 620B
tar.go 616B
cli.go 613B
psql.go 611B
logger.go 542B
validate.go 531B
config.go 503B
version.go 498B
config.go 489B
config.go 436B
config.go 430B
config.go 426B
config.go 371B
config.go 348B
config.go 342B
config.go 342B
types.go 310B
main.go 293B
types.go 274B
types.go 123B
LICENSE 1KB
Makefile 2KB
README.md 16KB
go.mod 1KB
go.sum 36KB
build.yaml 1KB
.brudi.mongodb.restic.yaml 485B
release.yaml 450B
.brudi.restic-forget.yaml 256B
configA_2.yaml 242B
.brudi.postgresql.yaml 221B
.brudi.mysql.yaml 214B
.brudi.postgresql-pgrestore.yaml 210B
.brudi.postgresql-psql.yaml 201B
.brudi.mongodb-restore.yaml 197B
.brudi.mysql-restore.yaml 195B
configA_1.yaml 194B
.brudi.mongodb.yaml 193B
.brudi.tar.yaml 180B
.brudi.tar-restore.yaml 173B
.brudi.restic.yaml 171B
.brudi.restic-restore.yaml 160B
.brudi.redis.yaml 131B
tarTestFile.yaml 0B
mongo.yml 935B
.goreleaser.yml 891B
mysql.yml 415B
postgresql.yml 331B
共 102 条
- 1
- 2
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9156
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 目标跟踪-基于目标中心点同时进行目标检测+目标跟踪算法实现-项目源码-优质项目实战.zip
- Python《文本特征分析-全唐诗数据挖掘及分析 》+源代码
- Netron-Setup-4.5.0
- 可编辑的地图图形3-世界、各洲、美国地图.xls
- NineAi 新版ChatGPT AI系统网站源码
- Anaconda3-2022.10windows版本
- 基于Servlet的URL访问安全控制.doc
- 可编辑的地图图形-2-中国到省、到市、到县地图.xls
- 快慢指针法判断链表是否有环-go语言实现
- Python《金融新闻数据挖掘分析 (数据抓取、NLP算法分析、量化策略、回测框架等)》+源代码+项目说明
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功