gitlab备份-迁移-升级方案9.2.7升级到15版本最佳实践

背景

了解官方提供的版本的升级方案

复制代码
- GitLab 8: 8.11.Z  8.12.0  8.17.7 
- GitLab 9: 9.0.13  9.5.10    9.2.7
- GitLab 10: 10.0.7  10.8.7
- GitLab 11: 11.0.6  11.11.8
- GitLab 12: 12.0.12  12.1.17  12.10.14
- GitLab 13: 13.0.14  13.1.11  13.8.8  13.12.15
- GitLab 14: 14.0.12  14.3.6  14.9.5  14.10.5
- GitLab 15: 15.0.5  15.1.6 (for GitLab instances with multiple web nodes) > 15.4.6  latest 15.Y.Z
参考资料
复制代码
官方文档
https://archives.docs.gitlab.com/15.11/ee/update/#upgrade-paths
清华大学开源软件镜像站
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
官方源
https://packages.gitlab.com/app/gitlab/gitlab-ce/search?dist=&filter=debs&page=147&q=
参考资料
https://blog.csdn.net/cfh0081/article/details/131393441
1. 数据备份
复制代码
gitlab-rake gitlab:backup:create   #备份命令
备份目录
/data/backups
1706000135_2024_01_23_9.2.7_gitlab_backup.tar
2.迁移恢复

#忽略其他环境,建议使用centos7版本,方便后期升级

2.1 下载rpm包,方便后期升级

查看原来系统的版本

bash 复制代码
cat /var/opt/gitlab/gitlab-rails/VERSION  #检查升级的版本
2.1 恢复初始环境
bash 复制代码
rpm -i gitlab-ce-9.2.7-ce.0.el7.x86_64.rpm

注意修改配置 gitlab.rb

bash 复制代码
gitlab-ctl reconfigure
gitlab-ctl restart
2.2 恢复旧数据

cd 备份目录下

bash 复制代码
gitlab-rake gitlab:backup:restore BACKUP=1706000135_2024_01_23_9.2.7
gitlab-ctl reconfigure  #重新生成配置文件
gitlab-ctl restart  #重启服务
gitlab-ctl status   #检查服务是否正常启动
gitlab-rake gitlab:check SANITIZE=true  #检查 GitLab 实例的配置和运行环境是否正确
cat /var/opt/gitlab/gitlab-rails/VERSION  #检查升级的版本
2.3 版本升级

配置yum源

bash 复制代码
[gitlab-ce]
name=gitlab-ce
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
repo_gpgcheck=0
gpgcheck=0
enable=1
gpgkey=https://packages.gitlab.com/gpg.key

开始升级参照升级顺序进行升级,每次升级完成重新加载配置,重启服务

bash 复制代码
yum -y install gitlab-ce-11.11.8-ce.0.el7.x86_64.rpm 
cat /var/opt/gitlab/gitlab-rails/VERSION  #检查版本
gitlab-ctl reconfigure  #重新加载配置
gitlab-ctl restart     #重启服务
为什么使用centos系统,

方便版本管理,后期升级完成后可以迁移其他系统。

rpm软件包提前下载是为了方便升级,下载地址如下

https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/

升级完成有如下提示

参考资料

bash 复制代码
https://blog.csdn.net/weixin_44093164/article/details/127869196?spm=1001.2101.3001.6650.9&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-9-127869196-blog-131288688.235%5Ev40%5Epc_relevant_anti_vip&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-9-127869196-blog-131288688.235%5Ev40%5Epc_relevant_anti_vip&utm_relevant_index=13
注意事项

12.10.14 -> 13.0.14升级注意

bash 复制代码
**12.10.14 -> 13.0.14**
此版本变动如下:
1、Puma代替unicorn作为默认web server
2、PostgreSQL最低版本提升到11。

停止数据连接服务:
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-ctl stop nginx
开始升级:
rpm -Uvh gitlab-ce-13.0.14-ce.0.el7.x86_64.rpm
gitlab-ctl restart

14.0.12 -> 14.3.6 升级注意

报错

There was an error running gitlab-ctl reconfigure:

解决方案
gitlab:background_migrations:finalize... 该命令有可能执行多次,直到无报错即可

bash 复制代码
gitlab-ctl stop
 
gitlab-ctl start postgresql
#复制刚才输出的命令 
sudo gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,ci_builds_metadata,id, "["id"]\'["id_convert_to bigint"]]']
gitlab-rake db:migrate
gitlab-ctl reconfigure  #重新初始化
gitlab-ctl restart      #重起服务
相关推荐
未济8 小时前
linux 配置环境变量
linux
傲世仙尊8 小时前
目录即文件-Ext文件系统收尾篇
linux·c语言
虎头金猫9 小时前
4K 视频总卡在公网带宽?用 N1 + OpenList 把网盘播放链路重新理顺
运维·服务器·网络·python·容器·beautifulsoup·pandas
_艾伦 耶格尔.10 小时前
进程间通信
linux
AI职业加油站10 小时前
AI智能体应用工程师证书:政策红利下的职业新风口
大数据·运维·人工智能·学习·职场发展
Liuqy-0510 小时前
Linux IO编程——静态库、动态库
linux
此冬歌咏11 小时前
K8s 节点故障实战:优雅驱逐 31 秒,硬故障 331 秒,以及那个永远 Pending 的 Pod
运维·k8s
彧azz11 小时前
Linux 环境下 Redis 学习总结:数据类型、持久化、锁、事务、主从与缓存问题
linux·redis·笔记·学习·面试
-梅12 小时前
linux(8) 软硬链接
linux·运维·服务器
AIgorithmGEEK12 小时前
[Linux]线程三部曲(上):一个执行流的诞生——从操作系统一路拆到 pthread_create
linux·线程·pid