GitLab项目批量备份,迁移

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了GitLab项目批量备份,迁移相关的知识,希望对你有一定的参考价值。

一. 创建备份文件

gitlab-rake gitlab:backup:create

使用以上命令会在/var/opt/gitlab/backups目录下创建一个名称类似为1547087542_2019_01_10_11.0.3_gitlab_backup.tar的压缩包, 这个压缩包就是Gitlab整个的完整部分, 其中开头的1547087542_2019_01_10_11.0.3是备份创建的日期

scp /var/opt/gitlab/backups/1547087542_2019_01_10_11.0.3_gitlab_backup.tar 192.168.61.28:/var/opt/gitlab/backups/

目标机器操作:

chmod 777 /var/opt/gitlab/backups/1547087542_2019_01_10_11.0.3_gitlab_backup.tar

gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-rake gitlab:backup:restore BACKUP=1547087542_2019_01_10_11.0.3
gitlab-ctl start

二.定时备份:

添加定时任务,每天凌晨两点,执行gitlab备份

0 2 * root /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1

以上是关于GitLab项目批量备份,迁移的主要内容,如果未能解决你的问题,请参考以下文章

gitlab 搭建 备份 升级 迁移恢复

gitlab 迁移 备份

gitlab备份和迁移

Gitlab备份恢复与迁移

从gitlab备份包恢复某个仓库

Gitlab---代码库备份的迁移与数据恢复