如何在gitlab 数据备份

导读 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

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/120143.html

(0)
上一篇 2021年8月28日
下一篇 2021年8月28日

相关推荐

发表回复

登录后才能评论