(1)备份
1.创建备份目录,并授权
mkdir /data/backups/gitlab -pv
chown -R git.git /data
2.修改gitlab配置
vim /etc/gitlab/gitlab.rb
gitlab_rails['backup_path'] = "/data/backups/gitlab" //备份路径
gitlab_rails['backup_keep_time'] = 604800 //备份7天
3.重新加载文件配置
gitlab-ctl reconfigure
gitlab-ctl restart
4.备份
# ll /data/backups/gitlab/1526974877_2018_05_22_10.7.3_gitlab_backup.tar
-rw-------. 1 git git 81920 5月 22 15:41 /data/backups/gitlab/1526974877_2018_05_22_10.7.3_gitlab_backup.tar
5.查看备份目录
ll /data/backups/gitlab/
(2)恢复
1.删除gitlab中的app1项目
2.停止数据写入服务
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
3.恢复数据:注意不要加全路径和后缀
gitlab-rake gitlab:backup:restore BACKUP=1526974877_2018_05_22_10.7.3
gitlab-ctl restart