一、事情起因

因机房服务器即将到期,需要将即将到期的服务器迁移至云上,迁移之前没有查看老环境的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: git@gitlab.zlkjbj.cn: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://git@114.115.181.98: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界面查看数据即可!!!

二、问题解决

迁移后访问首页没问题,但是访问项目时会报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 HTML
Parameters: {"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 }"

2018-07-09--记录一次gitlab迁移事件及遇到的问题的更多相关文章

  1. 2018.07.09 洛谷P2365 任务安排(线性dp)

    P2365 任务安排 题目描述 N个任务排成一个序列在一台机器上等待完成(顺序不得改变),这N个任务被分成若干批,每批包含相邻的若干任务.从时刻0开始,这些任务被分批加工,第i个任务单独完成所需的时间 ...

  2. 2018.07.09 顺序对齐(线性dp)

    顺序对齐 题目描述 考虑两个字符串右对齐的最佳解法.例如,有一个右对齐方案中字符串是 AADDEFGGHC 和 ADCDEGH. AAD~DEFGGHC ADCDE~~GH~ 每一个数值匹配的位置值 ...

  3. 2019.07.09 纪中_B

    错失AK记 2019.07.09[NOIP提高组]模拟 B 组 明明今天的题都很水,可就是没蒟蒻. 写题的时候: T0一眼高精(结果没切)T1看到2啊8啊果断转二进制观察,发现都是左移几位然后空出的位 ...

  4. 2021.07.09 K-D树

    2021.07.09 K-D树 前置知识 1.二叉搜索树 2.总是很长的替罪羊树 K-D树 建树 K-D树具有二叉搜索树的形态,对于每一个分类标准,小于标准的节点在父节点左边,大于标准的节点在父节点右 ...

  5. LEETCODE 07 09

    最近忙着面试耽误了几天,今天刷了07,09都是字符串处理,一个是大数反转,一个是回文数判断,我都是转成字符串处理的,过了是过了,但是挺慢的,先记着,等有机会优化下 题目 给定一个 32 位有符号整数, ...

  6. Gitlab迁移之数据库报错解决

    Gitlab迁移需同版本迁移,恢复过程会出现如下提示: WARNING:  no privileges were granted for "public" 解决方法: 1. 编辑/ ...

  7. 把Gitlab迁移到Docker容器里

    把Gitlab迁移到Docker容器里 Apr 9, 2015. | By: 任怀林 公司的gitlab一直是运行在ovm的虚拟机里的,版本还是6.7.5.版本有点老了,最近在研究docker,于是想 ...

  8. Trusted Block Chain Summit(2018.10.09)

    时间:2018.10.09地点:北京金隅喜来登大酒店

  9. China Cloud Computing Conference(2018.07.24)

    时间:2018.07.24地点:北京国家会议中心

随机推荐

  1. C# 泛型约束 xxx<T> Where T:约束(一)

    泛型约束 代码举例 发现我们游戏的代码中,主程写了很多类似这样的代码: public static T CreateObject<T>(out int objectId) where T ...

  2. Asp.net core 2.0.1 Razor 的使用学习笔记(二)

    ASP.net core 2.0.1 中 asp.net identity 2.0.1 的基本使用(一)—启用用户管理 一.修改和启用默认的用户账户管理和角色管理 在Data目录中添加Applicat ...

  3. ansible 碎记录

    https://www.zhukun.net/archives/8167 ansible -i new/hosts new -m authorized_key -a "user=root k ...

  4. arcgis pro2.3教程与问题集持续更新(一)

    Arcgis pro 2.3是64位的不支持mdb 数据库,因为微软没有开放Access64的接口,所以不能支持个人地理数据库.mdb(Microsoft Database). arcgis pro ...

  5. 【Python】os.path.isfile()的使用方法汇总

    方法一: # -*- coding:utf-8 -*- import os import sys from uiautomator import device as d filepath = r'E: ...

  6. linux 删除指定日期之前的文件

    两种方法: 1. 在一个目录中保留最近三个月的文件,三个月前的文件自动删除. find /email/v2_bak -mtime +92 -type f -name *.mail[12] -exec ...

  7. HTTP协议请求方式: 中GET、POST和HEAD的介绍_孤帆一叶

    HTTP协议中GET.POST和HEAD的介绍 2008-05-10 14:15 GET: 请求指定的页面信息,并返回实体主体.HEAD: 只请求页面的首部.POST: 请求服务器接受所指定的文档作为 ...

  8. PAT B1002 写出这个数

    读入一个自然数n,计算其各位数字之和,用汉语拼音写出和的每一位数字. 输入格式:每个测试输入包含1个测试用例,即给出自然数n的值.这里保证n小于10100. 输出格式:在一行内输出n的各位数字之和的每 ...

  9. [转载]FFmpeg中使用libx264进行码率控制

    1.  X264显式支持的一趟码率控制方法有:ABR, CQP, CRF. 缺省方法是CRF.这三种方式的优先级是ABR > CQP > CRF. if ( bitrate )       ...

  10. Can't create component 'xxx.xxx.xxx' as it has dependencies to be satisfied

    问题描述: Can't create component 'xxx.xxx.xxx' as it has dependencies to be satisfied. 问题原由: 没有对新建的实体映射类 ...