GoBackup

简单的工具,备份您的数据库、文件到 FTP/SCP/S3 存储。「Simple tool for backup your databases, files to FTP / SCP / S3 storages.」

Github星跟蹤圖

GoBackup

简单的工具,用于备份您的数据库,文件到云存储。

GoBackup 是一款针对 Web 服务器设计的全栈备份工具,类似于 backup/backup,配合 Crontab 自动备份。

你可以写一个配置文件,运行 gobackup 命令一次将数据库转储为文件,将配置文件归档,然后打包成一个文件。

它允许您将备份文件存储到本地、FTP、SCP、S3 或其他云存储空间。

详细中文介绍: https://ruby-china.org/topics/34094

https://gobackup.github.io/

特性

  • 无依赖性。
  • 支持多个数据库源。
  • 支持多种存储类型。
  • 将路径或文件归档到一个 tar 文件中。

当前支持状态

数据库

  • MySQL
  • PostgreSQL
  • Redis -- mode: sync/copy
  • MongoDB

归档

使用 tar 命令将多个文件或路径归档为 .tar 文件。

压缩

  • Tgz - .tar.gz
  • Uncompressed - .tar

加密

  • OpenSSL -- aes-256-cbc encrypt

存储

安装(macOS/Linux)

$ curl -sSL https://git.io/gobackup | bash

然后,你可以得到 /usr/local/bin/gobackup 命令

$ gobackup -h
NAME:
   gobackup - Easy full stack backup operations on UNIX-like systems

USAGE:
   gobackup [global options] command [command options] [arguments...]

VERSION:
   0.1.0

COMMANDS:
     perform
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version

配置

GoBackup 在以下位置寻找配置文件:

  • ./gobackup.yml
  • ~/.gobackup/gobackup.yml
  • /etc/gobackup/gobackup.yml

示例配置:gobackup_test.yml

models:
  gitlab:
    compress_with:
      type: tgz
    store_with:
      type: scp
      path: ~/backup
      host: your-host.com
      private_key: ~/.ssh/id_rsa
      username: ubuntu
      password: password
      timeout: 300
    databases:
      gitlab:
        type: mysql
        host: localhost
        port: 3306
        database: gitlab_production
        username: root
        password:
        additional_options: --single-transaction --quick
      gitlab_redis:
        type: redis
        mode: sync
        rdb_path: /var/db/redis/dump.rdb
        invoke_save: true
        password:
    archive:
      includes:
        - /home/git/.ssh/
        - /etc/mysql/my.conf
        - /etc/nginx/nginx.conf
        - /etc/nginx/conf.d
        - /etc/redis/redis.conf
        - /etc/logrotate.d/
      excludes:
        - /home/ubuntu/.ssh/known_hosts
        - /etc/logrotate.d/syslog
  gitlab_repos:
    store_with:
      type: local
      path: /data/backups/gitlab-repos/
    archive:
      includes:
        - /home/git/repositories

用法

$ gobackup perform
2017/09/08 06:47:36 ======== ruby_china ========
2017/09/08 06:47:36 WorkDir: /tmp/gobackup/1504853256396379166
2017/09/08 06:47:36 ------------- Databases --------------
2017/09/08 06:47:36 => database | Redis: mysql
2017/09/08 06:47:36 Dump mysql dump to /tmp/gobackup/1504853256396379166/mysql/ruby-china.sql
2017/09/08 06:47:36

2017/09/08 06:47:36 => database | Redis: redis
2017/09/08 06:47:36 Copying redis dump to /tmp/gobackup/1504853256396379166/redis
2017/09/08 06:47:36
2017/09/08 06:47:36 ----------- End databases ------------

2017/09/08 06:47:36 ------------- Compressor --------------
2017/09/08 06:47:36 => Compress with Tgz...
2017/09/08 06:47:39 -> /tmp/gobackup/2017-09-08T14:47:36+08:00.tar.gz
2017/09/08 06:47:39 ----------- End Compressor ------------

2017/09/08 06:47:39 => storage | FTP
2017/09/08 06:47:39 -> Uploading...
2017/09/08 06:47:39 -> upload /ruby_china/2017-09-08T14:47:36+08:00.tar.gz
2017/09/08 06:48:04 Cleanup temp dir...
2017/09/08 06:48:04 ======= End ruby_china =======

备份计划

你可能想定期运行备份,你需要 Crontab。

$ crontab -l
0 0 * * * /usr/local/bin/gobackup perform >> ~/.gobackup/gobackup.log
0 0 * * *表示每天凌晨0:00运行。

而在一天之后,你可以通过 ~/.gobackup/gobackup.log 来查询执行状态。

许可证

MIT


主要指標

概覽
名稱與所有者gobackup/gobackup
主編程語言Go
編程語言Go (語言數: 8)
平台Linux, Mac, Windows
許可證MIT License
所有者活动
創建於2017-09-06 09:14:52
推送於2025-06-18 09:18:51
最后一次提交
發布數75
最新版本名稱v2.15.3 (發布於 )
第一版名稱0.0.1 (發布於 )
用户参与
星數1.7k
關注者數25
派生數253
提交數513
已啟用問題?
問題數162
打開的問題數11
拉請求數118
打開的拉請求數1
關閉的拉請求數33
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?

GoBackup is a fullstack backup tool design for web servers similar with backup/backup, work with Crontab to backup automatically.

You can write a config file, run gobackup perform command by once to dump database as file, archive config files, and then package them into a single file.

It’s allow you store the backup file to local, FTP, SCP, S3 or other cloud storages.

GoBackup 是一个类似 backup/backup 的一站式备份工具,为中小型服务器/个人服务器而设计,配合 Crontab 以实现定时备份的目的。

使用 GoBackup 你可以通过一个简单的配置文件,一次(执行一个命令)将服务器上重要的(数据库、配置文件)东西导出、打包压缩,并备份到指定目的地(如:本地路径、FTP、云存储...)。

详细中文介绍: https://ruby-china.org/topics/34094

https://gobackup.github.io/

Features

  • No dependencies.
  • Multiple Databases source support.
  • Multiple Storage type support.
  • Archive paths or files into a tar.

Current Support status

Databases

  • MySQL
  • PostgreSQL
  • Redis - mode: sync/copy
  • MongoDB

Archive

Use tar command to archive many file or path into a .tar file.

Compressor

  • Tgz - .tar.gz
  • Uncompressed - .tar

Encryptor

  • OpenSSL - aes-256-cbc encrypt

Storages

Install (macOS / Linux)

$ curl -sSL https://git.io/gobackup