gitlab數據遷移 on centos

新舊服務器的gitlab版本必須一致

使用命令:gitlab-rake gitlab:env:info 查看版本信息。如下信息版本爲 11.8.3

[root@localhost /]# gitlab-rake gitlab:env:info
System information
System:
Current User:   git
Using RVM:      no
Ruby Version:   2.5.3p105
Gem Version:    2.7.6
Bundler Version:1.16.6
Rake Version:   12.3.2
Redis Version:  3.2.12
Git Version:    2.18.1
Sidekiq Version:5.2.5
Go Version:     unknown

GitLab information
Version:        11.8.3
Revision:       3f81311
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     postgresql
URL:            http://172.16.3.107:8818
HTTP Clone URL: http://172.16.3.107:8818/some-group/some-project.git
SSH Clone URL:  [email protected]:some-group/some-project.git
Using LDAP:     no
Using Omniauth: yes
Omniauth Providers:

GitLab Shell
Version:        8.4.4
Repository storage paths:
- default:      /program/data/gitlab/repositories
Hooks:          /opt/gitlab/embedded/service/gitlab-shell/hooks
Git:            /opt/gitlab/embedded/bin/git

backup舊服務器文件到新服務器

新舊服務器路徑一致

gitlab-secrets.json 。

路徑:/etc/gitlab/gitlab-secrets.json

數據文件

備份完成的文件存放目錄爲:/var/opt/gitlab/backups。顯示如下圖
時間戳:1568803844_2019_09_18
Gitlab版本:11.8.3
在這裏插入圖片描述
將備份文件拷貝到目標服務器同樣的路徑下

[root@develop-zz-01 1]# gitlab-rake gitlab:backup:create
2019-09-18 18:50:02 +0800 -- Dumping database ...
Dumping PostgreSQL database gitlabhq_production ... [DONE]
2019-09-18 18:50:02 +0800 -- done
2019-09-18 18:50:02 +0800 -- Dumping repositories ...
 * hongtai.qin/elzzdemo ... [SKIPPED]
2019-09-18 18:50:43 +0800 -- done
2019-09-18 18:50:43 +0800 -- Dumping uploads ...
2019-09-18 18:50:44 +0800 -- done
2019-09-18 18:50:44 +0800 -- Dumping builds ...
2019-09-18 18:50:44 +0800 -- done
2019-09-18 18:50:44 +0800 -- Dumping artifacts ...
2019-09-18 18:50:44 +0800 -- done
2019-09-18 18:50:44 +0800 -- Dumping pages ...
2019-09-18 18:50:44 +0800 -- done
2019-09-18 18:50:44 +0800 -- Dumping lfs objects ...
2019-09-18 18:50:44 +0800 -- done
2019-09-18 18:50:44 +0800 -- Dumping container registry images ...
2019-09-18 18:50:44 +0800 -- [DISABLED]
Creating backup archive: 1568803844_2019_09_18_11.8.3_gitlab_backup.tar ... done
Uploading backup archive to remote storage  ... skipped
Deleting tmp directories ... done
done
done
done
Deleting old backups ... skipping

在新服務器restore

依次執行下面三個命令

[root@develop-zz-01]# gitlab-ctl stop
[root@develop-zz-01]# gitlab-ctl reconfigure
[root@develop-zz-01]# gitlab-ctl start

執行恢復命令

[root@localhost ~]# gitlab-rake gitlab:backup:restore BACKUP=1568803844_2019_09_18_11.8.3

在這裏插入圖片描述
在這裏插入圖片描述

本地代碼切換遠程倉庫到新gitlab

刪除舊remote 地址。添加新的remote地址
在這裏插入圖片描述

推送本地代碼到新遠程分支

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章