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: 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迁移事件及遇到的问题的更多相关文章
- 2018.07.09 洛谷P2365 任务安排(线性dp)
P2365 任务安排 题目描述 N个任务排成一个序列在一台机器上等待完成(顺序不得改变),这N个任务被分成若干批,每批包含相邻的若干任务.从时刻0开始,这些任务被分批加工,第i个任务单独完成所需的时间 ...
- 2018.07.09 顺序对齐(线性dp)
顺序对齐 题目描述 考虑两个字符串右对齐的最佳解法.例如,有一个右对齐方案中字符串是 AADDEFGGHC 和 ADCDEGH. AAD~DEFGGHC ADCDE~~GH~ 每一个数值匹配的位置值 ...
- 2019.07.09 纪中_B
错失AK记 2019.07.09[NOIP提高组]模拟 B 组 明明今天的题都很水,可就是没蒟蒻. 写题的时候: T0一眼高精(结果没切)T1看到2啊8啊果断转二进制观察,发现都是左移几位然后空出的位 ...
- 2021.07.09 K-D树
2021.07.09 K-D树 前置知识 1.二叉搜索树 2.总是很长的替罪羊树 K-D树 建树 K-D树具有二叉搜索树的形态,对于每一个分类标准,小于标准的节点在父节点左边,大于标准的节点在父节点右 ...
- LEETCODE 07 09
最近忙着面试耽误了几天,今天刷了07,09都是字符串处理,一个是大数反转,一个是回文数判断,我都是转成字符串处理的,过了是过了,但是挺慢的,先记着,等有机会优化下 题目 给定一个 32 位有符号整数, ...
- Gitlab迁移之数据库报错解决
Gitlab迁移需同版本迁移,恢复过程会出现如下提示: WARNING: no privileges were granted for "public" 解决方法: 1. 编辑/ ...
- 把Gitlab迁移到Docker容器里
把Gitlab迁移到Docker容器里 Apr 9, 2015. | By: 任怀林 公司的gitlab一直是运行在ovm的虚拟机里的,版本还是6.7.5.版本有点老了,最近在研究docker,于是想 ...
- Trusted Block Chain Summit(2018.10.09)
时间:2018.10.09地点:北京金隅喜来登大酒店
- China Cloud Computing Conference(2018.07.24)
时间:2018.07.24地点:北京国家会议中心
随机推荐
- load file within a jar
String examplejsPrefix = "example"; String examplejsSuffix = "js"; String exampl ...
- PHP类继承、接口继承关系概述
PHP类继承: PHP类不支持多继承,也就是子类只能继承一个父类,但是支持多层次继承,比如: class frist{ public function __construct(){ echo &quo ...
- VPC见解
VPC是什么? VPC:Virtual Private Cloud,即虚拟私有云.讨论VPC时,我们可以从两个方面来讨论: 从服务的角度来看:VPC是一种云,但是这个云不属于我们常见的公有云.私有 ...
- DevExpress07、DataNavigator、 ControlNavigator
https://documentation.devexpress.com/WindowsForms/DevExpress.XtraEditors.DataNavigator.class 1.DataN ...
- Alpha冲刺报告(2/12)(麻瓜制造者)
今日任务总结 燃尽图如下: 具体完成情况如下: 江郑: 今天:完成了商品需求的数据库的基本构建. 遇到的问题:对于php的ci框架不熟,操作原理不懂 明天:和队友进行数据库的对接 符天愉: 今天:完成 ...
- React阻止事件冒泡的正确打开方式
需求:点击导航list按钮出现侧弹框,点击空白处弹框消失 问题:绑定空白处的点击事件到document上,但是非空白处的点击也会触发这个点击事件,在react中如何阻止事件冒泡? 解决方法:e.sto ...
- 夯实基础之--new关键字、instanceOf原理
1.instanceOf原理 检测右边构造函数的prototype是否在左边对象的原型链上,在返回true,不在返回false 例:function Persion(name,age){ this ...
- WMS - resource info
Description This sample shows how to work with an OGC Web Map Service (WMS). When WMSLayers are adde ...
- python第三十课--异常(异常对象传递过程)
演示异常对象传递的过程(往上“抛”),并将其解决 def func1(): print('func1...') print(10/0) def func2(): print('func2...') t ...
- POJ 1066 昂贵的聘礼
Description 年轻的探险家来到了一个印第安部落里. 在那里他和酋长的女儿相爱了,于是便向酋长去求亲.酋长要他用10000个金币作为聘礼才答应把女儿嫁给他.探险家拿不出这么多金币,便请求酋长减 ...