gitlab备份

备份脚本:
#!/bin/bash
BackupDir=/data/docker/volumes/data_gitlab_data/_data/backups
BackupNum=(ls $BackupDir | wc -l)
#backup
docker exec -i gitlab gitlab-rake gitlab:backup:create
#clear backup

if[ $BackupNum -gt 3 ];then
rm -f `find $BackupDir -name "gitlab_backup.tar" -mtime +3`
fi

迁移和备份
docker save -o gitlab.tar gitlab/gitlab-ce:latest
导入镜像
docker load -i gitlab.tar
修改备份包的权限
chmod 777 1578900099_2020_01_13_12.6.0-ee_gitlab_backup.tar
进入容器,执行命令,停止相关服务:
gitlab-ctl stop unicorn #停止相关数据连接服务
gitlab-ctl stop sidekiq
执行恢复指令:根据提示输入两次yes
gitlab-rake gitlab:backup:restore BACKUP=1578900099_2020_01_13_12.6.0
重新启动gitlab:gitlab-ctl start
Gitlab迁移和恢复必须要注意一点,新的gitlab服务器版本号必须和之前的gitlab版本号一致

你可能感兴趣的:(gitlabshell)