gitlab备份与恢复操作方法
github私有仓库是收费的,有些代码不方便托管到外面的git仓库,因此就产生了自己搭建git服务器的需求。
好在有广大的开源人士的贡献,有了gitlab这一神器。
手动配置较多,直接用集成包: bitnami-gitlab-6.4.3-1-linux-x64-installer.run
=============================
假定gitlab安装路径为: /opt/gitlab-6.4.3-1/
全程以root用户操作。
1.设定备份目录:
/opt/gitlab-6.4.3-1/apps/gitlab/htdocs/config/gitlab.yml

2.备份:
有些时候会报错: You have already activated rake 0.9.2.2,but our Gemfile requires rake 10.1.0,Using bundle exec may solve this.
原因是默认的path路径不对,需要执行下bitnami自带的环境变量设置脚本: use_gitlab 即可解决。

cd /opt/gitlab-6.4.3-1/
./use_gitlab
cd /opt/gitlab-6.4.3-1/apps/gitlab/htdocs
bundle exec bin/rake gitlab:backup:create RAILS_ENV=production
3.恢复:
BACKUP=timestamp_of_backup #(required if more than one backup exists):
cd /opt/gitlab-6.4.3-1/
./use_gitlab
cd /opt/gitlab-6.4.3-1/apps/gitlab/htdocs
bundle exec bin/rake gitlab:backup:restore RAILS_ENV=production BACKUP=1405247282
chown git:git -R /opt/gitlab-6.4.3-1/apps/gitlab/repositories
4.crontab定时备份脚本参考:
use_gitlab使用了exec,脚本会重新打开一个进程,没有上下文,所以需要单独提出path.
脚本需要使用root账户运行。脚本包含了rsync远程同步到nas相应目录中,按照自己实际修改即可(预先生成ssh证书,免密码登录)。
#!/bin/bash if [ `id -u` -ne 0 ];then
echo "this backup script must be exec as root."
exit
fi
date
PATH="/opt/gitlab-6.4.3-1/apps/gitlabci/gitlabci-runner/bin:/opt/gitlab-6.4.3-1/apps/gitlab/gitlab-shell/bin:/opt/gitlab-6.4.3-1/redis/bin:/opt/gitlab-6.4.3-1/sqlite/bin:/opt/gitlab-6.4.3-1/python/bin:/opt/gitlab-6.4.3-1/perl/bin:/opt/gitlab-6.4.3-1/git/bin:/opt/gitlab-6.4.3-1/ruby/bin:/opt/gitlab-6.4.3-1/mysql/bin:/opt/gitlab-6.4.3-1/apache2/bin:/opt/gitlab-6.4.3-1/common/bin:$PATH" echo "backup gitlab to local storage begin.. " cd /opt/gitlab-6.4.3-1/apps/gitlab/htdocs bundle exec bin/rake gitlab:backup:create RAILS_ENV=production echo "rsync -avzP --delete /data/backups_gitlab xxx@xxx.com:/mnt/disk1/docs/rsync_gitlab_backup"
rsync -avzP --delete /data/backups_gitlab xxx@xxx.com:/mnt/disk1/docs/rsync_gitlab_backup/ date
echo "this job is end."
gitlab备份与恢复操作方法的更多相关文章
- Git--07 Gitlab备份与恢复
目录 Gitlab备份与恢复 01). 备份 02). 恢复 Gitlab备份与恢复 对gitlab进行备份将会创建一个包含所有库和附件的归档文件.对备份的恢复只能恢复到与备份时的gitlab相同 ...
- gitlab 备份与恢复
1. gitlab 备份命令:# gitlab-rake gitlab:backup:create 1.1 查看备份文件(默认备份路径:/var/opt/gitlab/backups)# ls /va ...
- Gitlab备份与恢复、迁移与升级
0.Gitlab安装 1.安装和配置必要的依赖关系 在CentOS7,下面的命令将在系统防火墙打开HTTP和SSH访问. yum install curl openssh-server postf ...
- Gitlab备份与恢复[七]
标签(linux): git 笔者Q:972581034 交流群:605799367.有任何疑问可与笔者或加群交流 备份 配置文件中加入 gitlab_rails['bakup_path']='/da ...
- gitlab备份与恢复
(1)备份 1.创建备份目录,并授权 mkdir /data/backups/gitlab -pv chown -R git.git /data 2.修改gitlab配置 vim /etc/gitla ...
- 3、gitlab备份与恢复
1.备份 #修改配置文件,启用备份 [root@localhost ~]# vim /etc/gitlab/gitlab.rb 377 gitlab_rails['backup_path'] = &q ...
- gitlab 从古老的 bitnami 版本 迁移到官方最新版本
这是我之前发布在 yuque 的文章.是我刚来新公司的时候帮公司搬迁 git 记录下来的,现在看来去掉敏感部分直接发布也没啥问题啦,就搬家过来,我自己也方便查 XD . 8.1.6 -> 10. ...
- git学习------> Gitlab如何进行备份恢复与迁移?
前段时间,在某台CenterOS服务器上搭建了Gitlab环境,并且大家陆陆续续的都把代码从svn迁移到了gitlab,但是之前的CenterOS服务器并不是搭建在公司的机房环境,而是搭建在办公室的某 ...
- GitLab 迁移与升级
参考: [ 博客园 BigBao ] 环境说明: OS: CentOS 7.x gitlab-ce 初始版本: 8.8.5 gitlab-ce 升级到版本: 11.2.3 升级方式: rpm 安装升级 ...
随机推荐
- Maven管理多模块项目
首先,我们要明确的多模块项目的含义,它是指一个应用中包含多个module.一般来说,一个应用单独部署成服务,只是打包的时候,maven会把各个module组合在一起.各模块一般单独打成jar放到lib ...
- java 中 正则 正则表达式 匹配 url
不多说 [http|https]+[://]+[0-9A-Za-z:/[-]_#[?][=][.][&]]* 这个就是匹配 网络上的网址 又称 url . 最起码 绝大部分的taobao ur ...
- HDU 5775 Bubble Sort (线段树)
Bubble Sort 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5775 Description P is a permutation of t ...
- Java IO (3) - Reader
Java IO (3) - Reader 前言 JavaIO一共包括两种,一种是stream,一种是reader/writer,每种又包括in/out,所以一共是四种包.Java 流在处理上分为字符流 ...
- BNU 51276 - 道路修建 Small (并查集)
题目链接:http://www.bnuoj.com/v3/problem_show.php?pid=51276 具体题意不描述了,一眼看过去就是并查集,关键是添加边以后更新答案.我是开个二维的数组an ...
- mybatis杂记
mybatis学习官网: 1.如果项目中使用maven管理,又引用 了mybatis框架, 下面是mybatis官网给出的 mybatis在maven中央仓库的坐标原文 详情见连接:https://c ...
- 12个有趣的C语言面试题
摘要:12个C语言面试题,涉及指针.进程.运算.结构体.函数.内存,看看你能做出几个! 1.gets()函数 问:请找出下面代码里的问题: #include<stdio.h> int ma ...
- ThinkPHP3.1.3的单字母函数汇总
A函数: 用于实例化Action 格式:[项目://][分组/]模块 /** * A函数用于实例化Action 格式:[项目://][分组/]模块 * @param string $name Acti ...
- android ipc通信机制之之三,进程通讯方式。
IPC通讯方式的优缺点: IPC通讯方式的对比 名称 优点 缺点 适用场景 Bundle 简单易用 只能传输Bundle支持的数据类型 四大组件的进程通信 文件共享 简单易用 不适合高并发场景,并无法 ...
- MEF 编程指南(四):声明导入
组合部件通过 [System.ComponentModel.Composition.ImportAttribute] 特性声明导入.类似于导出,也有几种不同的方法声明导入,即通过:字段(Fields) ...