导读 gitlab的默认备份路径是/var/opt/gitlab/backups/,可以通过gitlab.rb来修改这个配置路径,gitlab_rails['backup_path'] = "/data/pgsql_bak"
1,全备份
集成包安装:
# gitlab-rake gitlab:backup:create

源码安装
# git -H bundle exec rake gitlab:backup:create RAILS_ENV=production

docker安装
# docker exec -t <容器名> gitlab-rake gitlab:backup:create
2,部分备份

db (数据库)
uploads (附件)
repositories (代码库)
builds (CI作业输出日志)
artifacts (CI工件)
lfs (LFS对象)
registry (注册图片)
pages (页面内容)

集成包安装:
# gitlab-rake gitlab:backup:create SKIP=uploads,repositories,builds,artifacts,lfs,registry,pages

源码安装
# git -H bundle exec rake gitlab:backup:create SKIP=uploads,repositories RAILS_ENV=production

docker安装
# docker exec -t <容器名> gitlab-rake gitlab:backup:create SKIP=uploads,registry,pages
3,crontab
集成包安装:
0 7 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1

源码安装
0 7 * * * cd /gitlab目录 && PATH=/usr/local/bin:/usr/bin:/bin bundle exec rake gitlab:backup:create RAILS_ENV=production CRON=1

docker安装
0 7 * * * /bin/docker exec -t <容器名> /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1

原文来自:http://blog.51yip.com/linux/2001.html

本文地址:https://www.linuxprobe.com/gitlab-copy.html编辑:公共, 帐号,审核员:逄增宝

Linux命令大全:https://www.linuxcool.com/