注意新建备份目录是:/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. Java从零开始学三十八(JAVA IO- 重定向IO)

    一.三个静态变量 java.lang.System提供了三个静态变量 System.in(默认键盘) System.out(默认显示器) System.err 二.重写向方法 System提供了三个重 ...

  2. SIT与UAT的分别

    在企业级软件的测试过程中,经常会划分为三个阶段——单元测试,SIT和UAT,如果开发人员足够,通常还会在SIT之前引入代码审查机制(Code Review)来保证软件符合客户需求且流程正确.下面简单介 ...

  3. OpenERP的短信(SMS)接口

    今天测试了一下OpenERP的短信(SMS)接口. 在OpenERP的Partner界面上,WebClient的右边的工具条有个“send sms”的按钮.OpenERP中发短信用的是短信的Web接口 ...

  4. github下载源码的三种方式

      从github上下载源码的三种方式 CreationTime--2018年6月7日15点21分 Author:Marydon 1.情景展示 2.实现方式 方式一:直接点击"Downloa ...

  5. 从域名到网站,快速创建全新社区站点 - phpwind一键部署操作文档

    关于phpwind一键部署服务,请查阅PW官网:http://www.phpwind.com/setup.html 选择一键部署镜像版本,立即开始使用: PW建站系统(Centos 64位) ———— ...

  6. AsyncTask和AsyncQueryHandler之比较

    定义AsyncTask子类 private class LoadContactsTask extends AsyncTask<Void, Void, List<TxrjContact> ...

  7. supervisor介绍与安装

    前言 今天同事让我帮忙安装一个叫supervisor的软件,但自己确实没接触过这个软件 自己做一下学习的记录 我首先是查询了一下supervisor的官网,初步认识一下这个软件 Supervisor是 ...

  8. 微信小程序四(设置底部导航)

    好了 小程序的头部标题 设置好了,我们来说说底部导航栏是如何实现的. 我们先来看个效果图 这里,我们添加了三个导航图标,因为我们有三个页面,微信小程序最多能加5个. 那他们是怎么出现怎么着色的呢?两步 ...

  9. 在Windows Service上安装运行Redis

    CSDN下载RedisWatcher,运行InstallWatcher.msi,默认安装在C:\Program Files (x86)\RedisWatcher,修改watcher.conf # re ...

  10. webdriver API study

    This chapter cover all the interfaces of Selenium WebDriver. Recommended Import Style The API defini ...