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. 递归和分治思想

    一、斐波那契数列 1 1 2 3 5 8 13 21 34 55 89 144 ...... 我们可以用数学函数来定义: |0,当n = 0 F(n) = |1,当n = 1

  2. gitlab备份与恢复

    一、gitlab备份 [root@localhost ~]# gitlab-rake gitlab:backup:create Dumping database ... Dumping Postgr

  3. redis的安装配置

    先介绍mac的安装方法 一、安装(首先你要先安装brew工具) brew install redis 然后在终端的末尾你会发现如下: if you don't want/need a backgr

  4. 如何应对缓存穿透和缓存雪崩问题

    分析:这两个问题,说句实在话,一般中小型传统软件企业,很难碰到这个问题。如果有大并发的项目,流量有几百万左右。这两个问题一定要深刻考虑。 缓存穿透,即黑客故意去请求缓存中不存在的数据,导致所有的请

  5. VirtualBox 中安装 Ubuntu 虚拟机并配置文件共享

    安装后,有时出现共享目录无法加载的现象,最后决定放弃,采用 VMWare Player !! 安装 VirtualBox 访问 https://www.virtualbox.org/ 下载最新版 V

随机推荐

  1. 递归和分治思想

    一、斐波那契数列 1 1 2 3 5 8 13 21 34 55 89 144 ...... 我们可以用数学函数来定义: |0,当n = 0 F(n) = |1,当n = 1

  2. gitlab备份与恢复

    一、gitlab备份 [root@localhost ~]# gitlab-rake gitlab:backup:create Dumping database ... Dumping Postgr

  3. redis的安装配置

    先介绍mac的安装方法 一、安装(首先你要先安装brew工具) brew install redis 然后在终端的末尾你会发现如下: if you don't want/need a backgr

  4. 如何应对缓存穿透和缓存雪崩问题

    分析:这两个问题,说句实在话,一般中小型传统软件企业,很难碰到这个问题。如果有大并发的项目,流量有几百万左右。这两个问题一定要深刻考虑。 缓存穿透,即黑客故意去请求缓存中不存在的数据,导致所有的请

  5. VirtualBox 中安装 Ubuntu 虚拟机并配置文件共享

    安装后,有时出现共享目录无法加载的现象,最后决定放弃,采用 VMWare Player !! 安装 VirtualBox 访问 https://www.virtualbox.org/ 下载最新版 V