一、事情起因

因机房服务器即将到期,需要将即将到期的服务器迁移至云上,迁移之前没有查看老环境的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.5Hint: git checkout v8.9.5 

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

[root@git-server yum.repos.d]# gitlab-rake gitlab:env:infoSystem 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.2GitLab 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:  git@gitlab.zlkjbj.cn:some-group/some-project.git
Using LDAP: no
Using Omniauth: noGitLab 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:infoSystem 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: unknownGitLab 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://git@114.115.181.98:52113/some-group/some-project.git
Using LDAP: no
Using Omniauth: noGitLab 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界面查看数据即可!!!

二、问题解决

迁移后访问首页没问题,但是访问项目时会报500的错误,是gitlab数据迁移时的一个缺陷。日志如下:

Started GET "/davidb/workflow-test2" for 127.0.0.1 at 2016-05-25 11:18:10 -0500
Processing by ProjectsController#show as HTMLParameters: {"namespace_id"=>"davidb", "id"=>"workflow-test2"}
Completed 500 Internal Server Error in 242ms (ActiveRecord: 7.4ms)OpenSSL::Cipher::CipherError (bad decrypt):app/models/project.rb:379:in `import_url'app/models/project.rb:409:in `external_import?'app/models/project.rb:401:in `import?'app/models/project.rb:417:in `import_in_progress?'app/controllers/projects_controller.rb:93:in `show'lib/gitlab/middleware/go.rb:16:in `call'

解决办法:

1、覆盖原来gitlab的 db_key_base到新的gitlab

db_key_base  位置在 /etc/gitlab/gitlab-secrets.json

2、EE版本执行命令
sudo gitlab-rails runner"Project.where(mirror: false).where.not(import_url: nil).each { |p| p.import_data.destroy if p.import_data }"

CE版本执行命令
sudo gitlab-rails runner"Project.where.not(import_url: nil).each { |p| p.import_data.destroy if p.import_data }"

转载于:https://www.cnblogs.com/hei-ma/p/9284202.html

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

  1. gitlab 迁移_无忌过招:手把手教你搭建自己的GitLab库

    01 前言 本文Gitlab的安装为主机方式, 获取其他安装方式请点击https://git.lug.ustc.edu.cn/help/install/README.md 02 架构 架构概述: Un ...

  2. CentOS下gitlab迁移和升级

    Gitlab迁移 迁移的整体思路是: 1.在新服务器上安装相同版本的gitlab 2.将备份生成的备份文件发送到新服务器的相同目录下 查看旧版本Gitlab的版本号 [root@gitlab ~] c ...

  3. 将中文日期转换成自己想要的格式如:2018年09月29日转换成2018-09-29

    def date_conversion(self,date): '''将中文日期转换成自己想要的格式如:2018年09月29日转换成2018-09-29''' c = list(re.findall( ...

  4. gitlab 迁移、升级打怪之路:8.8.5-- 8.10.8 -- 8.17.8 -- 9.5.9 -- 10.1.4 -- 10.2.5

    gitlab 迁移.升级打怪之路:8.8.5--> 8.10.8 --> 8.17.8 --> 9.5.9 --> 10.1.4 --> 10.2.5 gitlab 数据 ...

  5. 2018.07.30 巴别时代

    * 项目部署更新 用符号链接 project => project1, project2 ln -s project2 project * composer自动加载机制 namespace =& ...

  6. git迁移MySQL数据库_Centos7下Gitlab迁移数据库mysql过程

    [root@test ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [root@test ~]# uname -r ...

  7. 2018.07.19 仿优酷网页小项目

    时间:2018.07.19 大一下学期暑假 地点:成都-实习 项目类型:HTML+CSS仿优酷网页 制作时间:两天 网页源码: <!doctype html> <html> & ...

  8. 网吧服务器全部进不了系统,2018.07.12某网吧因为服务器系统盘健康度导致全体卡死重启的故障分析处理过程...

    原标题:2018.07.12某网吧因为服务器系统盘健康度导致全体卡死重启的故障分析处理过程 导读: 天晚上20:54接到某网吧电话,说整个网吧大部分电脑自动重启了,而且进不去系统了.立即用电脑远程登录 ...

  9. 【新书推荐】【2018.07】数字化战争

    [2018.07]数字化战争Digital War:A Critical Introduction,共308页. 如果需要电子版,请联系QQ:3042075372. 数字战争全面概述了数字技术对军事. ...

最新文章

  1. go标准库的学习-crypto/aes
  2. rpm包安装mysql5.6
  3. 06-typeAliases标签和package标签
  4. 获取一段html的内容简介
  5. matlab builder for java下载,Matlab Builder JA - Compile Matlab into a Java jar - Free Version?
  6. (30 gadget day 8) 你爱我有几分 — Mindwave mobile
  7. The more...., the more.....
  8. matlab logspace 虚数,Matlab入门教程
  9. 邮件服务器潜在漏洞的保护方法
  10. java编写九宫格拼图游戏_jquery 九宫格拼图游戏源码
  11. Python操作MongoDb与Redis以及ODM
  12. android 电池容量检测,电池容量检测优化app
  13. python编程大数据_学习Python编程挨着大数据什么事
  14. 简单的学生成绩管理系统
  15. QImage 如何设置图片的透明度
  16. 微信支付小程序支付和APP支付
  17. 互联网经典SQL面试题及答案解析
  18. win10 默认浏览器中找不到谷歌浏览器的解决办法
  19. 针对电子企业的仓储需求,提出WMS仓储管理系统解决方案
  20. ERROR: You appear to be running an X server; please exit X before installing.

热门文章

  1. quartus II Warning 好的时序是设计出来的,不是约束出来的
  2. HDU 4857 Couple doubi(找循环节)
  3. mysql keepalived_mysql高可用+keepalived
  4. minicom的按键控制_minicom使用指南
  5. 有哪些专业学python_学习python有哪些好书和学习方法?
  6. oracle 越南字符,ORACLE 12.2RAC之问题 ora.chad OFFLINE
  7. python经典题库和答案_吐血总结,Python经典面试题及答案
  8. halcon 形状匹配
  9. python 简单数据库_Python打造一个简单的本地数据库
  10. 7 centos 设置jvmgc_centos7配置java环境变量