gitlab数据备份
# gitlab-rake gitlab:backup:create
2020-08-11 23:26:51 +0000 -- Dumping database ...
Dumping PostgreSQL database gitlabhq_production ... [DONE]
2020-08-11 23:26:56 +0000 -- done
2020-08-11 23:26:56 +0000 -- Dumping repositories ...
* root/testproject (@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b) ... [SKIPPED]
[SKIPPED] Wiki
2020-08-11 23:26:57 +0000 -- done
2020-08-11 23:26:57 +0000 -- Dumping uploads ...
2020-08-11 23:26:57 +0000 -- done
2020-08-11 23:26:57 +0000 -- Dumping builds ...
2020-08-11 23:26:57 +0000 -- done
2020-08-11 23:26:57 +0000 -- Dumping artifacts ...
2020-08-11 23:26:57 +0000 -- done
2020-08-11 23:26:57 +0000 -- Dumping pages ...
2020-08-11 23:26:57 +0000 -- done
2020-08-11 23:26:57 +0000 -- Dumping lfs objects ...
2020-08-11 23:26:57 +0000 -- done
2020-08-11 23:26:57 +0000 -- Dumping container registry images ...
2020-08-11 23:26:57 +0000 -- [DISABLED]
Creating backup archive: 1597188417_2020_08_11_12.10.5_gitlab_backup.tar ... done
Uploading backup archive to remote storage ... skipped
Deleting tmp directories ... done
done
done
done
done
done
done
done
Deleting old backups ... skipping
Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data
and are not included in this backup. You will need these files to restore a backup.
Please back them up manually.
Backup task is done.
#
使用以上命令会在/var/opt/gitlab/backups目录下创建一个名称类似为1617070883_2021_03_30_13.7.1_gitlab_backup.tar的压缩包, 这个压缩包就是Gitlab整个的完整部分, 其中开头是备份创建的日期。
gitlab数据恢复
# 停止相关数据连接服务
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
# 从1393513186编号备份中恢复
gitlab-rake gitlab:backup:restore BACKUP=1393513186_gitlab_backup
# 启动Gitlab
sudo gitlab-ctl start
#gitlab-rake gitlab:backup:restore BACKUP=1597188417_2020_08_11_12.10.5
#