2018-07-09--记录一次gitlab迁移事件及遇到的问题

一、事情起因

    因机房服务器即将到期,需要将即将到期的服务器迁移至云上,迁移之前没有查看老环境的Gitlab是什么版本,直接装的Gitlab社区版,做数据导入时提示版本错误:

[root@vpn-server-001 devops]# gitlab-rake gitlab:backup:restore RAILS_ENV=production BACKUP=1531072861
Unpacking backup ... done
GitLab version mismatch:
  Your current GitLab version (11.0.2) differs from the GitLab version in the backup!
  Please switch to the following version and try again:
  version: 8.9.5


Hint: git checkout v8.9.5 

    此时去查看老环境的gitlab版本:

[root@git-server yum.repos.d]# gitlab-rake gitlab:env:info

System information
System:		
Current User:	git
Using RVM:	no
Ruby Version:	2.1.8p440
Gem Version:	2.5.1
Bundler Version:1.10.6
Rake Version:	10.5.0
Sidekiq Version:4.1.2

GitLab information
Version:	8.9.5                  #发现是8.9.5的
Revision:	f6ab19d
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	postgresql
URL:		http://gitlab.zlkjbj.cn
HTTP Clone URL:	http://gitlab.zlkjbj.cn/some-group/some-project.git
SSH Clone URL:	[email protected]:some-group/some-project.git
Using LDAP:	no
Using Omniauth:	no

GitLab Shell
Version:	3.0.0
Repositories:	/data/git-data/repositories
Hooks:		/opt/gitlab/embedded/service/gitlab-shell/hooks/
Git:		/opt/gitlab/embedded/bin/git

查看新环境的Gitlab版本:

[root@server-001 ~]# gitlab-rake gitlab:env:info

System information
System:		
Current User:	git
Using RVM:	no
Ruby Version:	2.4.4p296
Gem Version:	2.7.6
Bundler Version:1.16.2
Rake Version:	12.3.1
Redis Version:	3.2.11
Git Version:	2.17.1
Sidekiq Version:5.1.3
Go Version:	unknown

GitLab information
Version:	11.0.2             #新环境的版本为11.0.2
Revision:	d9540ee
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	postgresql
URL:		http://114.115.181.98
HTTP Clone URL:	http://114.115.181.98/some-group/some-project.git
SSH Clone URL:	ssh://[email protected]:52113/some-group/some-project.git
Using LDAP:	no
Using Omniauth:	no

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

知道问题后,下面是将新环境的Gitlab替换为8.9.5的版本:

yum remove -y gitlab-ce               #卸载新环境的Gitlab
yum install -y gitlab-ce-8.9.5         #指定安装8.9.5的版本的gitlab

然后做导入操作:

# gitlab-rake gitlab:backup:restore BACKUP=1531072861       #1531072861为你需要恢复备份的时间戳,文件名为:1531072861_gitlab_backup.tar 这种形式

然后登陆Gitlab界面查看数据即可!!!

猜你喜欢

转载自www.cnblogs.com/hei-ma/p/9284202.html