Gitlab 成功运行起来之后,最终的事情就是定期的备份,遇到问题后的还原。

备份配置

默认 Gitlab 的备份文件会创建在/var/opt/gitlab/backups文件夹中,格式为时间戳_日期_版本号_gitlab_backup.tar,例如:1515031353_2018_01_04_10.3.2_gitlab_backup.tar

修改备份文件夹,需要修改配置文件/etc/gitlab/gitlab.rb中的:

gitlab_rails['backup_path'] = '/your_wish/backups'

然后gitlabctl-reconfigure生效。

手动备份

命令:gitlab-backup create

For GitLab 12.1 and earlier, use

gitlab-rake gitlab:backup:create

会在命令执行的时间点,在你配置的文件夹或者默认文件夹创建一个备份文件。

自动备份

0 2 * * * /opt/gitlab/bin/gitlab-backup create CRON=1

备份恢复

First make sure your backup tar file is in the backup directory described in the gitlab.rb configuration gitlab_rails['backup_path']. The default is /var/opt/gitlab/backups. It needs to be owned by the git user.

cp 11493107454_2018_04_25_10.6.4-ce_gitlab_backup.tar /var/opt/gitlab/backups/
chown git.git /var/opt/gitlab/backups/11493107454_2018_04_25_10.6.4-ce_gitlab_backup.tar

Stop the processes that are connected to the database. Leave the rest of GitLab running:

gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
# Verify
gitlab-ctl status

Next, restore the backup, specifying the timestamp of the backup you wish to restore:

# This command will overwrite the contents of your GitLab database!
gitlab-backup restore BACKUP=1493107454_2018_04_25_10.6.4-ce

For GitLab 12.1 and earlier, use

gitlab-rake gitlab:backup:restore

Next, restore /etc/gitlab/gitlab-secrets.json if necessary as mentioned above.

Reconfigure, restart and check GitLab:

gitlab-ctl reconfigure
gitlab-ctl restart
gitlab-rake gitlab:check SANITIZE=true

If there is a GitLab version mismatch between your backup tar file and the installed version of GitLab, the restore command will abort with an error. Install the correct GitLab version and try again.

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

  1. gitlab备份恢复

    1.Gitlab 创建备份1.1 创建备份文件 首先我们得把老服务器上的Gitlab整体备份,使用Gitlab一键安装包安装Gitlab非常简单, 同样的备份恢复与迁移也非常简单. 使用一条命令即可创 ...

  2. gitlab之六: gitlab 备份恢复

    参考:   https://blog.csdn.net/ouyang_peng/article/details/77070977 备份: 所有的权限,库文件等信息全部备份到的 不更改备份目录的话: v ...

  3. gitlab备份、恢复、升级

    1.备份 gitlab的备份很简单,只要使用命令: gitlab-rake gitlab:backup:create 即可将当前的数据库.代码全部备份到/var/opt/gitlab/backups ...

  4. Gitlab安装与备份恢复

    GitHub是2008年由Ruby on Rails编写而成,与业界闻名的Github类似;但要将代码上传到GitHub上面,而且将项目设为私有还要收费.GitLab是一个用于仓库管理系统的开源项目, ...

  5. gitlab备份及恢复

    gitlab备份步骤 https://blog.csdn.net/qq_31666147/article/details/79844107 gitlab版本  下载地址 https://mirrors ...

  6. Gitlab备份和恢复操作记录

    前面已经介绍了Gitlab环境部署记录,这里简单说下Gitlab的备份和恢复操作记录: 1)Gitlab的备份目录路径设置 [root@code-server ~]# vim /etc/gitlab/ ...

  7. 转载:Gitlab备份和恢复操作记录

    转载:Gitlab备份和恢复操作记录 包含了备份和数据恢复的操作记录,实验可行 前面已经介绍了Gitlab环境部署记录,这里简单说下Gitlab的备份和恢复操作记录: 1)Gitlab的备份目录路径设 ...

  8. 使用Gitlab一键安装包后的日常备份恢复与迁移

    Gitlab 创建备份 使用Gitlab一键安装包安装Gitlab非常简单, 同样的备份恢复与迁移也非常简单. 使用一条命令即可创建完整的Gitlab备份: gitlab-rake gitlab:ba ...

  9. GitLab备份的创建与恢复

    使用Gitlab一键安装包安装Gitlab非常简单, 同样的备份恢复与迁移也非常简单. 使用一条命令即可创建完整的Gitlab备份: gitlab-rake gitlab:backup:create使 ...

随机推荐

  1. Django 小实例S1 简易学生选课管理系统 3 创建用户模型(model)

    Django 小实例S1 简易学生选课管理系统 第3节--创建用户模型(model) 点击查看教程总目录 作者自我介绍:b站小UP主,时常直播编程+红警三,python1对1辅导老师. 本文涉及到的新 ...

  2. Java设计模式之(三)——建造者模式

    1.什么是建造者模式 Separate the construction of a complex object from its representation so that the same co ...

  3. InnoDB 索引详解

    1.什么是索引 索引是存储引擎用于快速找到记录的一种数据结构. 2.索引有哪些数据结构 顺序查找结构:这种查找效率很低,复杂度为O(n).大数据量的时候查询效率很低. 有序的数据排列:二分查找法又称折 ...

  4. [nowcoder5669J]Jumping on the Graph

    考虑枚举$k$并求出$f(k)=\sum_{i=1}^{n}\limits\sum_{j=i+1}^{n}\limits [D(i,j)\le k]$,那么答案就是$\sum_{i=1}^{1e9}( ...

  5. [bzoj4943]蚯蚓排队

    询问相当于要求长度为k的公共子串个数,很容易联想到hash,由于询问是对全局的,因此对全局开一个hash的桶对于合并/删除操作,将中间新产生/需要删除的字符串暴力修改即可,单次复杂度最坏为$o(k^{ ...

  6. 2、使用HashOperations操作redis(Hash哈希表)

    文章来源:https://www.cnblogs.com/shiguotao-com/p/10560458.html 方法 c参数 s说明 Long delete(H key, Object... h ...

  7. python-django111111111111

    111 内置电池的意思就是,内置了很多功能,插件等等帮助文档:https://docs.djangoproject.com/en/3.0/ model,很多集成的东西,连接数据库等 vierm: Te ...

  8. Linux—crontab 定期执行程序的命令

    crontab [ -u user ] { -l | -r | -e } 说明: crontab 是用来让使用者在固定时间或固定间隔执行程序之用,换句话说,也就是类似使用者的时程表. -u user ...

  9. a.out的由来

    用过linux的都知道,在linux下编译链接程序,如果不加-o参数,生成的binary代码的名字都是默认的a.out.一不小心,a.out还会覆盖上次其他code生成的binary代码. a.out ...

  10. lxml解析库的安装和使用

    一.lxml的安装lxml是Python的一个解析库,支持HTML和XML的解析,支持XPath解析方式,而且解析效率非常高.本节中,我们了解一下lxml的安装方式,这主要从Windows.Linux ...