注意新建备份目录是:/usr/local/src/repositories 属主和属组:

  1. # ll -d repositories/
  2. drwx------ git root Feb : repositories/

修改配置文件:

  1. vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
  1. ## Backup settings
  2. backup:
  3. #path: "/var/opt/gitlab/backups" # Relative paths are relative to Rails.root (default: tmp/backups/)
  4. path: "/usr/local/src/repositories" # Relative paths are relative to Rails.root (default: tmp/backups/)

有些linux系统是需要改此文件:/etc/gitlab/gitlab.rb

重启# gitlab-ctl restart

备份git:

  1. # gitlab-rake gitlab:backup:create

恢复备份:

  1. # gitlab-ctl stop unicorn
  2. # gitlab-ctl stop sidekiq
  3. # ls /usr/local/src/repositories/
  4. 1484140459_gitlab_backup.tar
  5. # gitlab-rake gitlab:backup:restore BACKUP=
  6. Unpacking backup ...
  7. #如果数据迁移的话一定要保持gitlab的版本是一至,不然会报错!!!
  8. # gitlab-ctl start

亲测:

  1. # grep 'backup' -C /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
  2.  
  3. ## Backup settings
  4. backup:
  5. path: "/var/opt/gitlab/backups" # Relative paths are relative to Rails.root (default: tmp/backups/)
  6. keep_time: # default: (forever) (in seconds)
  7. #可以看到备份后的数据路径为:/var/opt/gitlab/backups
  8. [root@GitLab backups]# pwd
  9. /var/opt/gitlab/backups
  10. [root@GitLab backups]# ls
  11. [root@GitLab backups]# gitlab-rake gitlab:backup:create
  12. Dumping database ...
  13. Dumping PostgreSQL database gitlabhq_production ... [DONE]
  14. done
  15. Dumping repositories ...
  16. * root/document ... [DONE]
  17. * root/document.wiki ... [SKIPPED]
  18. * ok/hx-it-doc ... [DONE]
  19. * ok/hx-it-doc.wiki ... [SKIPPED]
  20. done
  21. Dumping uploads ...
  22. done
  23. Creating backup archive: 1486695836_gitlab_backup.tar ... done
  24. Deleting tmp directories ... done
  25. Deleting old backups ... skipping
  26. [root@GitLab backups]# ls
  27. 1486695836_gitlab_backup.tar
  28. 数据还原:
  29. 把数据1486695836_gitlab_backup.tar 放到/var/opt/gitlab/backups
  30. [root@GitLab src]# gitlab-ctl stop unicorn
  31. ok: down: unicorn: 1s, normally up
  32. [root@GitLab src]# gitlab-ctl stop sidekiq
  33. ok: down: sidekiq: 0s, normally up
  34. [root@GitLab backups]# pwd
  35. /var/opt/gitlab/backups
  36. [root@GitLab backups]# ls
  37. 1486695836_gitlab_backup.tar#注意这个文件的名子是在备份的时修生成的不能改变!!!!
  38. [root@GitLab backups]# gitlab-rake gitlab:backup:restore BACKUP= #数据版号1486695836_gitlab_backup.tar
  39. 下现在为止git数据恢复完成!!

gitlab人备份与恢复的更多相关文章

  1. gitlab的备份与恢复与迁移

    一.gitlab的备份1.1 创建备份目录,并授权 1 2 3 4 [root@linux-node1 ~]# mkdir /data/backups/gitlab -p [root@linux-no ...

  2. GitLab数据备份与恢复

    创建备份 $ sudo gitlab-rake gitlab:backup:create 执行完备份命令后会在/var/opt/gitlab/backups目录下生成备份后的文件,如150080913 ...

  3. docker安装的gitlab的备份与恢复

    1.对docker容器安装gitlab备份 1) 查看容器id docker ps 2) 将容器备份成镜像文件 docker commit -a 'James' -m 'gitlab_backup' ...

  4. Git7:使用Gitlab管理远程仓库

    目录 1.安装 2.gitlab基本配置 3.gitlab的邮件配置 3.1.使用本地的postfix发送邮件 3.2.使用邮件发送模板 3.3.使用腾讯企业邮箱配置发送邮件 3.4.使用163邮箱来 ...

  5. Gitlab服务器维护

    一. 内容 Gitlab服务器的更新 Gitlab服务器备份与恢复 导入Git仓库 二. Gitlab服务器的更新 1. 使用SSH登陆Gitlab服务器 2. 停止后端的unicorn服务器 [ro ...

  6. ubuntu16部署gitlab

    一.gitlab的安装 1. 安装依赖包 $ sudo apt-get update #如无ssh还需安装openssh-server $ sudo apt-get install postfix c ...

  7. gitlab升级备份

    一.备份有关备份和恢复的操作,详见我的另一篇博客:Gitlab的备份与恢复在开始升级之前,一定要做好备份工作,并记录好版本号.1.查看当前Gitlab的版本号 [root@gitlab ~]# cat ...

  8. Github版本管理以及git使用

    1.git客户端编译安装 同步系统时间服务器 ntpdate cn.ntp.org.cn 安装依赖包: [root@baolin ~]# yum install epel-release -y [ro ...

  9. gitlab多人协作开发

    gitlab多人协同工作 本文为亨利向<Git权威指南>的作者蒋鑫老师的答疑邮件写成. 这里特别感谢蒋鑫老师对我询问gitlab的协同工作流程问题的详细解答. 蒋鑫老师的细致专业的解答让我 ...

随机推荐

  1. Hadoop,HBase集群环境搭建的问题集锦(二)

    10.艾玛, Datanode也启动不了了? 找到log: Caused by: java.net.UnknownHostException: Invalid host name: local hos ...

  2. JS将数字转换为大写汉字人民币

    <script language="jscript"> function convertCurrency(currencyDigits) { // Constants: ...

  3. 〖Windows〗zigbee实验之cygwin编译TestSimpleMac出错的解决方法

    1. 错误代码如下: ... C51 COMPILER V8. - SN: K1CMC-IEYCYC COPYRIGHT KEIL ELEKTRONIK GmbH - *** ERROR C141 I ...

  4. Filezilla开源FTP传输工具

    生于忧患,死于安乐!在进取中思考... 官网:https://filezilla-project.org/ #FileZilla截图 免费.开源的FTP链接工具! 云下载: http://pan.ba ...

  5. iOS支付宝支付集成

    概述 iOS支付宝支付集成 详细 代码下载:http://www.demodashi.com/demo/10729.html 支付宝和微信都是业界的老大哥,相信大家都有所觉得文档.SDK都是各种坑吧( ...

  6. HDUOJ----2489 Minimal Ratio Tree

    Minimal Ratio Tree Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Other ...

  7. HDUOJ-----4506小明系列故事——师兄帮帮忙

    小明系列故事——师兄帮帮忙 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Tot ...

  8. hdu--DFS

    DFS Time Limit: 5000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submiss ...

  9. 仿京东左侧菜单 hover效果-简易demo

    简单描述: 用到的知识点 css 中的绝对定位 以及 Js 中的事件冒泡(或事件委托) .cont{display:inline-block;width:200px;height:200px;bord ...

  10. PSQL_标准API和Interface基本的用法和比较(概念)

    2014-01-05 Created By BaoXinjian