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

posted @ 2021-01-14 10:08  Dothraki  阅读(57)  评论(0编辑  收藏  举报