|NO.Z.00017|——————————|CloudNative|——|CI/CD&GitLab操作 .V07|——|GitLab.恢复|
一、gitlab恢复
### --- gitlab server部署
~~~ 参照前面部署方案
二、查看备份相关的配置项
### --- 查看备份相关的配置项
~~~ 修改该配置,定义了默认备份出文件的路径,
~~~ 并执行 gitlab-ctl reconfigure 或者 gitlab-ctl restart 重启服务生效。
[root@server11 ~]# vim /etc/gitlab/gitlab.rb
gitlab_rails['backup_path'] = "/data/gitlab/backups"
三、恢复前需要先停掉数据连接服务
### --- 停止unicorn、sidekiq
~~~ 如果是台新搭建的主机,不需要操作,理论上不停这两个服务也可以。
~~~ 停这两个服务是为了保证数据一致性。
[root@server11 ~]# gitlab-ctl stop unicorn
[root@server11 ~]# gitlab-ctl stop sidekiq
四、同步备份文件到新服务器
### --- 将老服务器/data/gitlab/backups目录下的
~~~ 备份文件拷贝到新服务器上的/data/gitlab/backups
[root@server11 gitlab]# rsync -avz 1530773117_2019_03_05_gitlab_backup.tar 192.168.95.135:/data/gitlab/backups/
~~~ 注意权限:600权限是无权恢复的。 实验环境可改成了777,生产环境建议修改属主属组
[root@server11 backups]# pwd
/data/gitlab/backups
[root@server11 backups]# chown -R git.git 1530773117_2019_03_05_gitlab_backup.tar
[root@server11 backups]# ll
total 17328900
-rwxrwxrwx 1 git git 17744793600 Jul 5 14:47 1530773117_2018_07_05_gitlab_backup.tar
五、执行命令进行恢复
### --- 后面再输入两次 yes 就完成恢复了。
~~~ 注意:backups 目录下保留一个备份文件可直接执行
[root@server11 ~]# gitlab-rake gitlab:backup:restore BACKUP=1530773117_2018_07_05_gitlab_backup.tar
六、恢复完成启动服务
### --- 恢复完成后,启动刚刚的两个服务,或者重启所有服务,再打开浏览器进行访问,
~~~ 发现数据和之前的一致:
~~~ 通过备份文件恢复gitlab必须保证两台主机的gitlab版本一致,否则会提示版本不匹配
[root@server11 ~]# gitlab-ctl start unicorn
[root@server11 ~]# gitlab-ctl start sidekiq
~~~ #OR
[root@server11 ~]# gitlab-ctl restart
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
——W.S.Landor
分类:
cdv015-jenkins2
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?