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地点:北京国家会议中心
随机推荐
- 表格排序(tablesorter)
1.在html页面的head中引用 <script src="/static/Bootstrap/js/jquery/jquery.tablesorter.min.js"&g ...
- 【转】Java学习---垃圾回收算法与 JVM 垃圾回收器综述
[原文]https://www.toutiao.com/i6593931841462338062/ 垃圾回收算法与 JVM 垃圾回收器综述 我们常说的垃圾回收算法可以分为两部分:对象的查找算法与真正的 ...
- [WPF]启动参数
在App.xaml.cs中重写方法OnStartup protected override void OnStartup(StartupEventArgs e) { //e.Args为命令行参数 // ...
- Linux搭建kafka
一.安装Java 1.查看linux 的系统版本 root@aliyun:~# uname --m x86_64 2.安装java mkdir -p /usr/local/java tar -xf j ...
- [LOJ 6031]「雅礼集训 2017 Day1」字符串
[LOJ 6031] 「雅礼集训 2017 Day1」字符串 题意 给定一个长度为 \(n\) 的字符串 \(s\), \(m\) 对 \((l_i,r_i)\), 回答 \(q\) 个询问. 每个询 ...
- Python3中遇到UnicodeEncodeError: 'ascii' codec can't encode characters in ordinal not in range(128)
在 linux服务器上运行代码报错: Python3中遇到UnicodeEncodeError: ‘ascii’ codec can’t encode characters in ordinal no ...
- BZOJ2744:[HEOI2012]朋友圈(最大团,乱搞)
Description 在很久很久以前,曾经有两个国家和睦相处,无忧无虑的生活着.一年一度的评比大会开始了,作为和平的两国,一个朋友圈数量最多的永远都是最值得他人的尊敬,所以现在就是需要你求朋友圈的最 ...
- c++ 智能指针、函数指针和指针函数
智能指针: 1.内存泄漏memory leak :是指程序在申请内存后,无法释放已申请的内存空间,一次内存泄漏似乎不会有大的影响,但内存泄漏堆积后的后果就是内存溢出. 2.内存溢出 out of me ...
- ICSharpCode.SharpZipLib 开源压缩库使用示例
官方网站:http://www.icsharpcode.net/OpenSource/SharpZipLib/Default.aspx 插件描述: ICSharpCode.SharpZipLib.dl ...
- nodeSelector + deamonset
DaemonSet 配置文件的语法和结构与 Deployment 几乎完全一样,只是将 kind 设为 DaemonSet. 选择运行节点:当指定.spec.template.spec.nodeSel ...