gitlab人备份与恢复
备份 恢复 gitlab
2023-09-14 09:00:10 时间
注意新建备份目录是:/usr/local/src/repositories 属主和属组:
# ll -d repositories/ drwx------ 4 git root 4096 Feb 7 17:32 repositories/
修改配置文件:
vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
## Backup settings backup: #path: "/var/opt/gitlab/backups" # Relative paths are relative to Rails.root (default: tmp/backups/) path: "/usr/local/src/repositories" # Relative paths are relative to Rails.root (default: tmp/backups/)
有些linux系统是需要改此文件:/etc/gitlab/gitlab.rb
重启# gitlab-ctl restart
备份git:
# gitlab-rake gitlab:backup:create
恢复备份:
# gitlab-ctl stop unicorn # gitlab-ctl stop sidekiq # ls /usr/local/src/repositories/ 1484140459_gitlab_backup.tar # gitlab-rake gitlab:backup:restore BACKUP=1484140459 Unpacking backup ... #如果数据迁移的话一定要保持gitlab的版本是一至,不然会报错!!! # gitlab-ctl start
亲测:
# grep 'backup' -C 2 /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml ## Backup settings backup: path: "/var/opt/gitlab/backups" # Relative paths are relative to Rails.root (default: tmp/backups/) keep_time: # default: 0 (forever) (in seconds) #可以看到备份后的数据路径为:/var/opt/gitlab/backups [root@GitLab backups]# pwd /var/opt/gitlab/backups [root@GitLab backups]# ls [root@GitLab backups]# gitlab-rake gitlab:backup:create Dumping database ... Dumping PostgreSQL database gitlabhq_production ... [DONE] done Dumping repositories ... * root/document ... [DONE] * root/document.wiki ... [SKIPPED] * ok/hx-it-doc ... [DONE] * ok/hx-it-doc.wiki ... [SKIPPED] done Dumping uploads ... done Creating backup archive: 1486695836_gitlab_backup.tar ... done Deleting tmp directories ... done Deleting old backups ... skipping [root@GitLab backups]# ls 1486695836_gitlab_backup.tar 数据还原: 把数据1486695836_gitlab_backup.tar 放到/var/opt/gitlab/backups中 [root@GitLab src]# gitlab-ctl stop unicorn ok: down: unicorn: 1s, normally up [root@GitLab src]# gitlab-ctl stop sidekiq ok: down: sidekiq: 0s, normally up [root@GitLab backups]# pwd /var/opt/gitlab/backups [root@GitLab backups]# ls 1486695836_gitlab_backup.tar#注意这个文件的名子是在备份的时修生成的不能改变!!!! [root@GitLab backups]# gitlab-rake gitlab:backup:restore BACKUP=1486695836 #数据版号1486695836_gitlab_backup.tar 下现在为止git数据恢复完成!!
相关文章
- 荣耀手机备忘录误删除能恢复吗?如何恢复没有备份的便签?
- linux系统中实现mongodb3.0.5数据库自动备份
- 【Oracle】逻辑备份失败ORA-39002,39070,29283,06512
- 《oracle每天一练》Oracle冷备份与数据恢复
- 写一个文件备份脚本
- Centos7 增量备份数据脚本
- MySQL数据库备份
- 傻瓜式实战Oracle10g RMAN之数据库备份和恢复之catalog模式
- mysqldump备份数据库 mysql恢复数据库
- Oralce备份恢复优秀文摘
- MySQL增量备份与恢复实例
- mysql备份方案
- mongdb备份恢复
- 文件的基本管理和XFS文件系统备份恢复
- RAC-OCR的备份和恢复
- gitlab备份与恢复操作整理
- Oracle数据库冷备份与恢复(救命稻草)
- atitit.跨语言实现备份mysql数据库 为sql文件特性 api 兼容性java c#.net php js
- Axure——恢复以及备份功能从容面对意外
- PVE挂载远程NAS目录作为storage PVE挂载 远程 备份空间
- 102.第十九章 MySQL数据库 -- MySQL的备份和恢复(十二)
- Mongodb 物理备份和恢复 —— 筑梦之路
- 企业里Win10 开启BitLocker锁定磁盘,如何备份系统,当系统出现问题又如何恢复,快速恢复又兼顾系统安全(远程设备篇)
- Mysql之mysqldump整库备份单表恢复还原
- Oracle用户管理的备份与恢复
- MySQL主从配置及mysqldump备份实战
- gitlab备份恢复(四)
- 计划任务备份
- 企业里Win10 开启BitLocker锁定磁盘,如何备份系统,当系统出现问题又如何恢复,快速恢复又兼顾系统安全