注意新建备份目录是:/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. UITableViewCell 取消选中的蓝色背景

    方案一: [self.tableView setAllowsSelection:NO]; 方案二: [cell setSelectionStyle:UITableViewCellSelectionSt ...

  2. webstorm激活+汉化教程

    1.安装教程+激活 输入的激活网址: http://idea.imsxm.com/ 2.汉化教程 软件适用于:webstorm2017.2以及以上,如有需要可直接加本人QQ 1940694428.

  3. Hibernate(十五)注解

    一.Hibernate注解 使用注解的方式来注释类和属性,从而完成对象和关系的映射 二.步骤 三.注解标签 四.查询

  4. [转]自定义Drawable实现灵动的红鲤鱼动画(上篇)

    此篇中的小鱼动画是模仿国外一个大牛做的flash动画,第一眼就爱上它了,简约灵动又不失美学,于是抽空试着尝试了一下,如下是我用Android实现的效果图:   小鱼儿 由于整个绘制分析过程比较繁琐所以 ...

  5. Mysql自己主动备份

    Mysql自己主动备份 批处理命令: set"Ymd=%date:~,4%%date:~5,2%%date:~8,2%" set"hMs=%time:~,2%%time: ...

  6. Hotaru&#39;s problem(hdu5371+Manacher)多校7

    Hotaru's problem Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

  7. 解决windows10 启动蓝屏 ntfs file system

    启动 --> 疑难解答 -->高级工具 --> 命令行--> chkdsk /x /f c: cd c: ok ^_-

  8. 【Python】学习笔记六:循环

    循环是一个结构,导致一个程序要重复一定的次数 条件循环也一样,当条件变为假,循环结束 For循环 在python for循环遍历序列,如一个列表或一个字符. for循环语法:   ——for iter ...

  9. 科学计算法帮助类MathUtils

    import java.math.BigDecimal; import java.math.MathContext; import java.math.RoundingMode; /** * 科学计算 ...

  10. S3 服务(Simple Storage Service简单存储服务) 简介(与hdfs同一级)

    图1  spark 相关 亚马逊云存储之S3(Simple Storage Service简单存储服务) (转 ) S3是Simple Storage Service的缩写,即简单存储服务.亚马逊的名 ...