GoBackup 数据库备份工具

本文最后更新于 91 天前, 如有失效请评论区留言.

GoBackup 是一个为中小型服务器而设计备份工具,内置计划任务,帮你定时备份数据库、配置文件,通过导出、打包压缩,最终存储到外部云存储(如S3等)

特性

  • 多数据库支持
  • 支持多种存储类型
  • 支持压缩
  • 作为守护程序运行以按计划进行备份
  • 可视化UI
  • 支持消息通知

支持的数据库

支持常见的数据库,仅列出我测试过的

  • mysql
  • postgresql
  • mariadb

支持的存储类似

支持常见的对象存储,仅列出我测试过的

  • local
  • minio

通知途径

支持常见的备份通知类型,仅列出我测试过的

  • Telegram
  • Feishu

安装配置

官方提供了一个默认安装脚本:

curl -sSL https://gobackup.github.io/install | sh

创建并编辑配置文件/etc/gobackup/gobackup.yml或者/root/.gobackup/gobackup.yml, 模版如下:

web:
  host: 0.0.0.0
  # port: 2703
  username: ysicing
  password: ysicing

models:
  solitudes-dev:
    description: "backup solitudes dev db"
    schedule:
      cron: "*0 */2 * * *"
    databases:
      solitudes:
        type: postgresql
        host:  postgresql.default.svc
        port: 5432
        database: solitudes
        username: solitudes
        password: examplepassowrd
    default_storage: minio
    storages:
      minio:
        type: minio
        bucket: gobackup
        endpoint: http://minio.default.svc:9000
        path: /blog/pg/dev
        access_key_id: ysicing
        secret_access_key: ysicing
      local:
        type: local
        path: /data/backups/blog/dev
        keep: 10
    notifiers:
      feishu:
        type: feishu
        url: https://open.feishu.cn/open-apis/bot/v2/hook/feishu-token
    compress_with:
      type: tgz

开始执行备份:

gobackup perform

后台守护进程:

gobackup start

其他

目前已经稳定备份大概几个月了,不足的地方

  • 目前好像只有local支持清理策略,暂时只能通过minio的生命周期来管理维护
  • 消息通知暂不支持全局
  • 如备份的PG库存在多版本(大版本)时,确实比较麻烦

Sponsor

Like this article? $1 reward

Comments

According to the relevant laws and regulations of the People's Republic of China, the comment function of the current website has been disabled. If you need to comment, please visit ysicing.me, but the comments still need to be reviewed by AI.