其他分享
首页 > 其他分享> > gitlab备份与恢复

gitlab备份与恢复

作者:互联网

gitlab配置备份目录
vim /etc/gitlab/gitlab.rb

gitlab_rails['manage_backup_path'] = true
gitlab_rails['backup_path'] = "/data/gitlab/backups" #设置备份路径
gitlab_rails['backup_keep_time'] = 604800 #备份保留七天
重新加载配置
gitlab-ctl reconfigure

实时备份:gitlab-rake gitlab:backup:create #就会在配置目录/data/gitlab/backups下生成备份文件
1528102291_2018_06_04_10.8.3_gitlab_backup.tar #备份出来的文件格式
添加到定时任务
00 02 * gitlab-rake gitlab:backup:create &>/dev/null

gitlab恢复
停止数据写入
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq

chmod 777 /data/gitlab/backups/1528102291_2018_06_04_10.8.3_gitlab_backup.tar
恢复#自动前往备份路径/data/gitlab/backups下找备份(不需要添加_gitlab_backup.tar)
gitlab-rake gitlab:backup:restore BACKUP=1528102291_2018_06_04_10.8.3

启动gitlab
[root@gitlab-ce ~]# gitlab-ctl start

标签:恢复,备份,gitlab,data,ctl,backups,backup
来源: https://blog.51cto.com/u_13236892/2694179