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地址
在这里插入图片描述

推送本地代码到新远程分支

在这里插入图片描述

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