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

# ll -d repositories/
drwx------ git root Feb : 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=
Unpacking backup ...
#如果数据迁移的话一定要保持gitlab的版本是一至,不然会报错!!!
# gitlab-ctl start

亲测:

# grep 'backup' -C  /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: (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_gitlab_backup.tar
下现在为止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. Activex打包于发布完整版---ActiveX打包

    前面介绍了数字证书的原理与制作:http://blog.csdn.net/jiangtongcn/article/details/13508365,下面来看一下ActiveX组件的打包. 我现在有一个 ...

  2. CSS nth-child、first-child、last-child、nth-of-type、first-of-type和last-of-type选择器使用

    以下示例主要讲解nth-child.first-child.last-child.nth-of-type.first-of-type和last-of-type使用. 示例代码: <!DOCTYP ...

  3. 重置outlook 2010

    1.进入 D:\program files\mirosoft office\ioffice14 2.outlook /importprf .\.prf 3.账号问题可以-->控制面板--> ...

  4. How to set up OpenERP for various timezone kindly follow the following steps to select timezone in OpenERP

        How to set up OpenERP for different Time Zones Click on the "Edit Preferences" wheel a ...

  5. eclipse 如何修改maven插件本地仓库jar包默认存储位置

      eclipse 如何修改maven插件本地仓库jar包默认存储位置 CreateTime--2018年4月18日11:04:47 Author:Marydon 1.更改eclipse的maven本 ...

  6. 在浏览器中使用JS打开并展示PDF文件

    使用jquery.media.js插件 示例: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat=& ...

  7. CentOS 7 网络磁盘挂载到本地 并测试传输速度

    本文中的配置只做测试使用,正式环境中考虑到安全,请自行结合网上介绍的配置细节完善配置内容. 首先明确两个概念,服务器和客户端(本地),我们要做的是将服务端的硬盘上的/home/liuyx 目录挂载到本 ...

  8. iOS开发之复制字符串到剪贴板

    概述 一般有邀请复制链接需求功能,把字符串复制到系统剪贴板,供用户粘贴使用链接. 详细 代码下载:http://www.demodashi.com/demo/10714.html 一.主要思路 1.在 ...

  9. 解决:Access denied for user ''@'sinochip-79e833' (using password: NO)

    uthentication to host '' for user '' using method 'mysql_native_password' failed with message: Acces ...

  10. Android快速开发不可或缺的11个工具类(下载)

    功能分类:工具     支持平台:Android     运行环境:Eclipse 开发语言:Java      开发工具:Eclipse         源码大小:11.45KB   下载地址:ht ...