GITLAB 备份与恢复

captains 2021-07-20 PM 1022℃ 0条

gitlab.jpg

gitlab数据备份与恢复

1. 停止gitlab数据服务
[root@gitlab ~]# gitlab-ctl stop unicorn
ok: down: unicorn: 0s, normally up
[root@gitlab ~]# gitlab-ctl stop sidekiq
ok: down: sidekiq: 1s, normally up
2. 手动备份数据
#执行gitlab数据备份
[root@gitlab ~]# gitlab-rake gitlab:backup:create
# 备份完成后启动gitlab
[root@gitlab ~]# gitlab-ctl start
3. 查看要恢复的文件
#gitlab数据备份目录,命令备份
[root@gitlab ~]# cd /var/opt/gitlab/backups/
[root@gitlab backups]# ll
total 264
-rw------- 1 git git 133120 Sep 15 14:20 1600150852_2020_09_15_12.2.5_gitlab_backup.tar
-rw------- 1 git git 133120 Sep 16 15:38 1600241917_2020_09_16_12.2.5_gitlab_backup.tar
drwx------ 7 git git    131 Sep 15 14:54 tmp
# nginx配置文件
[root@gitlab backups]# ll /var/opt/gitlab/nginx/conf/
total 12
-rw-r--r-- 1 root root 4017 Aug 26 00:27 gitlab-http.conf
-rw-r--r-- 1 root root 2978 Aug 26 00:27 nginx.conf
-rw-r--r-- 1 root root  603 Aug 26 00:27 nginx-status.conf
# gitlab配置文件
[root@gitlab backups]# ll /etc/gitlab/gitlab.rb 
-rw------- 1 root root 94249 Aug 26 19:33 /etc/gitlab/gitlab.rb
# key文件
[root@gitlab backups]# ll /etc/gitlab/gitlab-secrets.json 
-rw------- 1 root root 15611 Aug 26 19:35 /etc/gitlab/gitlab-secrets.json
4. 执行恢复
# 恢复数据之前停止服务
[root@gitlab backups]# gitlab-ctl stop unicorn
ok: down: unicorn: 0s, normally up
[root@gitlab backups]# gitlab-ctl stop sidekiq
ok: down: sidekiq: 0s, normally up
#恢复数据 命令+linux时间戳_年_月_日_gitkab版本号,一直yes下去
[root@gitlab backups]# gitlab-rake gitlab:backup:restore BACKUP=1600241917_2020_09_16_12.2.5
5. 启动服务
[root@gitlab backups]# gitlab-ctl start sidekiq
ok: run: sidekiq: (pid 10475) 0s
[root@gitlab backups]# gitlab-ctl start unicorn
ok: run: unicorn: (pid 10501) 1s

标签: GITLAB

非特殊说明,本博所有文章均为博主原创。

评论啦~