1、备份
修改备份配置,gitlab配置文件(/etc/gitlab/gitlab.rb)
# 备份文件的保存路径 gitlab_rails['backup_path'] = "/var/opt/gitlab/backups" # 备份文件的权限 gitlab_rails['backup_archive_permissions'] = 0644 # 备份文件的保存时间,单位 秒 gitlab_rails['backup_keep_time'] = 2419200
# 添加定时任务,自动备份
[root@gitlab-cxzh ~]# crontab -l
00 03 * * 1 gitlab-rake gitlab:backup:create > /dev/null 2>&1
2、恢复
# 停止相关数据连接服务 gitlab-ctl stop unicorn gitlab-ctl stop sidekiq
# 备份文件的存放路径:/var/opt/gitlab/backups/,默认放在这儿,也可以自己修改(/etc/gitlab/gitlab.rb) chmod 777 /var/opt/gitlab/backups/1530156812_2018_06_28_10.8.4_gitlab_backup.tar gitlab-rake gitlab:backup:restore BACKUP=1530156812_2018_06_28_10.8.4 ⚠️:输入两次yes并回车 # 启动gitlab gitlab-ctl start
3、平级迁移
首先安装gitlab,然后拷贝备份文件到新服务器的/var/opt/gitlab/backups/路径中,然后重复第二部分恢复就好了