sudo yum install -y curl policycoreutils-python openssh-server postfix
/etc/gitlab/gitlab.rb,设置:gitlab_rails['backup_path'] = "/your/backup/path" # 默认为/var/opt/gitlab/backups
gitlab_rails['backup_keep_time'] = 604800 # 保留时间(秒),如7天
执行 sudo gitlab-ctl reconfigure 使配置生效。sudo gitlab-rake gitlab:backup:create
备份文件默认存放在 /var/opt/gitlab/backups,文件名格式为 TIMESTAMP_gitlab_backup.tar。使用 crontab 设置定时任务,例如每天凌晨2点备份:
crontab -e
添加以下内容:
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq
sudo gitlab-rake gitlab:backup:restore BACKUP=备份编号
输入 yes 确认覆盖。sudo gitlab-ctl start
参考来源: