gitlab备份还原

gitlab目录存放

/var/opt/gitlab/git-data/repositories/ 库默认存储目录
/opt/gitlab/ 应用代码和相应的依赖程序
/etc/gitlab/ 配置文件目录
/var/log/gitlab/ 此目录下存放了gitlab各个组件产生的日志
/var/opt/gitlab/backups/ 备份文件生成的目录
变更配置文件,需要以下操作
gitlab-ctl reconfigure 重置配置文件
gitlab-ctl show-config 验证配置文件
一、备份
配置文件中加入
gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"
gitlab_rails['backup_keep_time'] = 604800

如果自定义备份目录需要赋予git权限

mkdir /data/backup/gitlab
chown -R git.git /data/backup/gitlab

添加定时任务Crontab  

0 2 * * * /usr/bin/gitlab-rake gitlab:backup:create

二、还原

1.停止gitlab进程

[root@localhost gitlab]# gitlab-ctl stop unicorn
ok: down: unicorn: 0s, normally up
[root@localhost gitlab]# gitlab-ctl stop sidekiq
ok: down: sidekiq: 0s, normally up

2.恢复还原,并且重启

mv 1564562420_2019_07_31_10.0.0_gitlab_backup.tar 1564562420_gitlab_backup.tar
gitlab-rake gitlab:backup:restore BACKUP=1564562420
gitlab-ctl restart
原文地址:https://www.cnblogs.com/lucktomato/p/14877584.html