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      #重起服务
相关推荐
苹果醋311 分钟前
大模型实战--FastChat一行代码实现部署和各个组件详解
java·运维·spring boot·mysql·nginx
梁诚斌1 小时前
VSOMEIP代码阅读整理(1) - 网卡状态监听
运维·服务器·网络
深情废杨杨1 小时前
服务器几核几G几M是什么意思?如何选择?
运维·服务器
康熙38bdc1 小时前
Linux 进程优先级
linux·运维·服务器
Web极客码1 小时前
常见的VPS或者独立服务器的控制面板推荐
运维·服务器·控制面板
hhzz1 小时前
Linux Shell编程快速入门以及案例(Linux一键批量启动、停止、重启Jar包Shell脚本)
android·linux·jar
只是有点小怂1 小时前
parted是 Linux 系统中用于管理磁盘分区的命令行工具
linux·运维·服务器
三枪一个麻辣烫2 小时前
linux基础命令
linux·运维·服务器
cuisidong19972 小时前
如何在 Kali Linux 上安装 Google Chrome 浏览器
linux·运维·chrome
光通信学徒3 小时前
ubuntu图形界面右上角网络图标找回解决办法
linux·服务器·ubuntu·信息与通信·模块测试