GitLab作为最常用的版本控制管理工具,是日常开发中必备的代码管理工具。本节内容我们详细记录一下GitLab的备份与恢复。



- #执行更新gitlab配置命令
- gitlab-ctl reconfigure
- #gitlab备份
- gitlab-rake gitlab:backup:create



- # 停止gitlab服务
- gitlab-ctl stop sidekiq
- gitlab-ctl stop Puma
-
- # 查看gitlab服务状态
- gitlab-ctl status
- #根据备份恢复gitlab仓库
- gitlab-rake gitlab:backup:restore BACKUP=/var/opt/gitlab/backups/<备份文件版本号>


- #重启gitlab
- gitlab-ctl restart


①创建gitlab的备份脚本
#!/bin/bash #执行备份命令 /usr/bin/gitlab-rake gitlab:backup:create
②授权
#授权 chmod 777 gitlab_back.sh
③测试每5分钟备份一次gitlab仓库
*/5 * * * * /bin/bash /var/opt/gitlab/gitlab_back.sh > /dev/null 2>&1
④测试结果
关于gitlab备份与恢复的内容到这里就结束了,下期见。。。