gitlab备份与恢复

模板网 2021-04-14

一、gitlab备份

[root@localhost ~]# gitlab-rake gitlab:backup:create
Dumping database ...
Dumping PostgreSQL database gitlabhq_production ... [DONE]
done
Dumping repositories ...
 * newgroup/test ... [SKIPPED]
 * newgroup/test.wiki ...  [SKIPPED]
 * zhangsan/zsproject ... [SKIPPED]
 * zhangsan/zsproject.wiki ...  [SKIPPED]
done
Dumping uploads ...
done
Dumping builds ...
done
Dumping artifacts ...
done
Dumping pages ...
done
Dumping lfs objects ...
done
Dumping container registry images ...
[DISABLED]
Creating backup archive: 1521890768_2018_03_24_10.6.0_gitlab_backup.tar ... done
Uploading backup archive to remote storage  ... skipped
Deleting tmp directories ... done
done
done
done
done
done
done
done
Deleting old backups ... skipping

备份文件所在目录

[root@localhost ~]# ls /var/opt/gitlab/backups
1521890768_2018_03_24_10.6.0_gitlab_backup.tar

二、gitlab 恢复

需要停掉以下2个服务(停止数据的变更)

[root@localhost ~]# gitlab-ctl stop unicorn
ok: down: unicorn: 0s, normally up
[root@localhost ~]# gitlab-ctl stop sidekiq
ok: down: sidekiq: 0s, normally up
[root@localhost ~]# gitlab-rake backup:restore BACKUP=1521890768_2018_03_24_10.6.0
rake aborted!
Don't know how to build task 'backup:restore' (see --tasks)
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
(See full trace by running task with --trace)

启动服务 [root@localhost ~]# gitlab-ctl start

三、备份与还原过程中的权限问题

更多:https://jianshu.com/p/68a39c7193e7

mkdir /var/opt/gitlab/backups

chown git /var/opt/gitlab/backups

chmod 700 /var/opt/gitlab/backups

相关文章

  1. 虚拟环境-virtualenv

    在开发Python应用程序的时候,系统安装的Python3只有一个版本:3.4。所有第三方的包都会被pip安装到Python3的site-packages目录下。 如果我们要同时开发多个应用程序,那

  2. 常见排序列表

    常见排序列表 中文名称 英文名称 平均时间复杂度 最坏时间复杂度 最好时间复杂度 空间复杂度 稳定性 选择排序 Selection n^2 n^2 n^2 1 不稳 冒泡排序 Bub

  3. 路由器

  4. 编程常用词汇表

    这里整理了一些常用词汇,供在编码中使用: 通用 数学 列表 时间 图像 文件目录 执行 业务 用户相关 文章相关 商品相关 优惠券相关 订单相关 这里总结了一些软件开发中常用的词汇,如

  5. python多线程

    一、介绍 多任务可以由多进程完成,也可以由一个进程内的多线程完成。 我们前面提到了进程是由若干线程组成的,一个进程至少有一个线程。 由于线程是操作系统直接支持的执行单元,因此,高级语言通常都内置多线

随机推荐

  1. 虚拟环境-virtualenv

    在开发Python应用程序的时候,系统安装的Python3只有一个版本:3.4。所有第三方的包都会被pip安装到Python3的site-packages目录下。 如果我们要同时开发多个应用程序,那

  2. 常见排序列表

    常见排序列表 中文名称 英文名称 平均时间复杂度 最坏时间复杂度 最好时间复杂度 空间复杂度 稳定性 选择排序 Selection n^2 n^2 n^2 1 不稳 冒泡排序 Bub

  3. 路由器

  4. 编程常用词汇表

    这里整理了一些常用词汇,供在编码中使用: 通用 数学 列表 时间 图像 文件目录 执行 业务 用户相关 文章相关 商品相关 优惠券相关 订单相关 这里总结了一些软件开发中常用的词汇,如

  5. python多线程

    一、介绍 多任务可以由多进程完成,也可以由一个进程内的多线程完成。 我们前面提到了进程是由若干线程组成的,一个进程至少有一个线程。 由于线程是操作系统直接支持的执行单元,因此,高级语言通常都内置多线