音效素材网提供各类素材,打造精品素材网站!

站内导航 站长工具 投稿中心 手机访问

音效素材

CentOS7下GitLab跨大版本升级的方法
日期:2019-07-22 10:24:46   来源:脚本之家

备份&升级

在升级前一定要做好备份,记录自己当前gitlab-ca的版本号。

查看当前gitlab版本号

[root@localhost ~]# yum list | grep gitlab-ce
gitlab-ce.x86_64              9.3.6-ce.0.el7       installed

备份文件

[root@localhost ~]# gitlab-rake gitlab:backup:create
Dumping database ... 
Dumping PostgreSQL database gitlabhq_production ... [DONE]
done
Dumping repositories ...
 * dev/dubbo ... [DONE]
 * dev/dubbo.wiki ... [SKIPPED]
 * dev/dubbox-master ... [DONE]
 * dev/dubbox-master.wiki ... [SKIPPED]
 * MobileTerminal/MobileDoc ... [SKIPPED]
 * MobileTerminal/MobileDoc.wiki ... [SKIPPED]
 * TrakCare/Doc ... [SKIPPED]
 * TrakCare/Doc.wiki ... [SKIPPED]
 * PerationMaintenance/PMDoc ... [DONE]
 * PerationMaintenance/PMDoc.wiki ... [DONE]
 * doc/his ... [DONE]
 * doc/his.wiki ... [SKIPPED]
 * PerationMaintenance/image ... [SKIPPED]
 * PerationMaintenance/image.wiki ... [SKIPPED]
done
Dumping uploads ... 
done
Dumping builds ... 
done
Dumping artifacts ... 
done
Dumping pages ... 
done
Dumping lfs objects ... 
done
Dumping container registry images ... 
[DISABLED]
Creating backup archive: 1552552057_2019_03_14_9.3.6_gitlab_backup.tar ... done
Uploading backup archive to remote storage ... skipped
Deleting tmp directories ... done
done
done
done
done
done
done
done
Deleting old backups ... skipping

在目录/var/opt/gitlab/backups/下会生成一个备份文件如:1552552057_gitlab_backup.tar,其中1552552057即为此次备份都版本号。

还原备份(失败)

gitlab-rake gitlab:backup:restore BACKUP=备份版本号

配置gitlab-yum源

[root@localhost ~]# cat << EOF > /etc/yum.repos.d/gitlab-ce.repo
> [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
> EOF

yum install安装

[root@localhost ~]# yum install gitlab-ce-9.5.9
已加载插件:fastestmirror, langpacks
gitlab-ce                                                                                                                | 2.9 kB 00:00:00   
gitlab-ce/primary_db                                                                                                          | 2.7 MB 00:00:01   
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 gitlab-ce.x86_64.0.9.3.6-ce.0.el7 将被 升级
---> 软件包 gitlab-ce.x86_64.0.9.5.9-ce.0.el7 将被 更新
--> 解决依赖关系完成

依赖关系解决

===============================================================================================================================================================================================================================================================
 Package                           架构                           版本                                源                              大小
===============================================================================================================================================================================================================================================================
正在更新:
 gitlab-ce                          x86_64                          9.5.9-ce.0.el7                           gitlab-ce                          381 M

事务概要
===============================================================================================================================================================================================================================================================
升级 1 软件包

总下载量:381 M
Is this ok [y/d/N]: Y
Downloading packages:
No Presto metadata available for gitlab-ce
gitlab-ce-9.5.9-ce.0.el7.x86_6 FAILED                                      18% [==================-                                          ] 659 B/s | 70 MB 137:35:05 ETA 
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.5.9-ce.0.el7.x86_64.rpm: [Errno 12] Timeout on https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.5.9-ce.0.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
正在尝试其它镜像。
gitlab-ce-9.5.9-ce.0.el7.x86_6 FAILED                                      21% [======================                                         ] 646 B/s | 83 MB 134:19:56 ETA 
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.5.9-ce.0.el7.x86_64.rpm: [Errno 12] Timeout on https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.5.9-ce.0.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
正在尝试其它镜像。
gitlab-ce-9.5.9-ce.0.el7.x86_6 FAILED                                      81% [===================================================================================-          ] 411 B/s | 311 MB 50:00:08 ETA 
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.5.9-ce.0.el7.x86_64.rpm: [Errno 12] Timeout on https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.5.9-ce.0.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
正在尝试其它镜像。
gitlab-ce-9.5.9-ce.0.el7.x86_64.rpm                                                                                                   | 381 MB 00:01:52   
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
gitlab preinstall: Automatically backing up only the GitLab SQL database (excluding everything else!)
Dumping database ... 
Dumping PostgreSQL database gitlabhq_production ... [DONE]
done
Dumping repositories ...
[SKIPPED]
Dumping uploads ... 
[SKIPPED]
Dumping builds ... 
[SKIPPED]
Dumping artifacts ... 
[SKIPPED]
Dumping pages ... 
[SKIPPED]
Dumping lfs objects ... 
[SKIPPED]
Dumping container registry images ... 
[DISABLED]
Creating backup archive: 1552553362_2019_03_14_9.3.6_gitlab_backup.tar ... done
Uploading backup archive to remote storage ... skipped
Deleting tmp directories ... done
done
Deleting old backups ... skipping
 正在更新  : gitlab-ce-9.5.9-ce.0.el7.x86_64 [############################################################################################################################                                      ] 1/2 正在更新  : gitlab-ce-9.5.9-ce.0.el7.x86_64 [##############################################################################################################################                   正在更新  : gitlab-ce-9.5.9-ce.0.el7.x86_64                                                                                                1/2 


    *.         *.
   ***         ***
   *****        *****
  .******       *******
  ********      ********
  ,,,,,,,,,***********,,,,,,,,,
 ,,,,,,,,,,,*********,,,,,,,,,,,
 .,,,,,,,,,,,*******,,,,,,,,,,,,
   ,,,,,,,,,*****,,,,,,,,,.
     ,,,,,,,****,,,,,,
      .,,,***,,,,
        ,*,.

   _______ __ __     __
  / ____(_) /_/ /  ____ _/ /_
  / / __/ / __/ /  / __ `/ __ \
 / /_/ / / /_/ /___/ /_/ / /_/ /
 \____/_/\__/_____/\__,_/_.___/


gitlab: Thank you for installing GitLab!
gitlab: To configure and start GitLab, RUN THE FOLLOWING COMMAND:

sudo gitlab-ctl reconfigure

gitlab: GitLab should be reachable at http://192.168.x.x:8090/gitlab
gitlab: Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
gitlab: And running reconfigure again.
gitlab: 
gitlab: For a comprehensive list of configuration options please see the Omnibus GitLab readme
gitlab: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
gitlab: 
 清理    : gitlab-ce-9.3.6-ce.0.el7.x86_64                                                                                      2/2 
Checking PostgreSQL executables: OK
Shutting down all GitLab services except those needed for migrations
ok: down: gitaly: 1s, normally up
ok: down: gitlab-monitor: 0s, normally up
ok: down: gitlab-workhorse: 1s, normally up
ok: down: logrotate: 0s, normally up
ok: down: nginx: 1s, normally up
ok: down: node-exporter: 0s, normally up
ok: down: postgres-exporter: 0s, normally up
ok: down: postgresql: 0s, normally up
ok: down: prometheus: 0s, normally up
ok: down: redis: 1s, normally up
ok: down: redis-exporter: 0s, normally up
ok: down: sidekiq: 0s, normally up
ok: down: unicorn: 0s, normally up
ok: run: postgresql: (pid 3362) 1s
ok: run: redis: (pid 3370) 0s
run: postgresql: (pid 3362) 1s; run: log: (pid 866) 3488369s
run: redis: (pid 3370) 0s; run: log: (pid 897) 3488369s
Reconfiguring GitLab to apply migrations


 * Moving existing certificates found in /opt/gitlab/embedded/ssl/certs

 * Symlinking existing certificates found in /etc/gitlab/trusted-certs
gitlab Reconfigured!
Checking for an omnibus managed postgresql: OK
Checking if we already upgraded: OK
The latest version 9.6.3 is already running, nothing to do
Ensuring PostgreSQL is updated: OK
Restarting previously running GitLab services
ok: run: gitaly: (pid 4046) 2s
ok: run: gitlab-monitor: (pid 4086) 1s
ok: run: gitlab-workhorse: (pid 4068) 2s
ok: run: logrotate: (pid 4120) 1s
ok: run: nginx: (pid 4126) 0s
ok: run: node-exporter: (pid 4177) 0s
ok: run: postgres-exporter: (pid 4184) 1s
ok: run: postgresql: (pid 3362) 72s
ok: run: prometheus: (pid 4094) 3s
ok: run: redis: (pid 3370) 71s
ok: run: redis-exporter: (pid 4194) 0s
ok: run: sidekiq: (pid 4203) 1s
ok: run: unicorn: (pid 4216) 0s

Upgrade complete! If your GitLab server is misbehaving try running

  sudo gitlab-ctl restart

before anything else. If you need to roll back to the previous version you can
use the database backup made during the upgrade (scroll up for the filename).
 验证中   : gitlab-ce-9.5.9-ce.0.el7.x86_64                                                                                      1/2 
 验证中   : gitlab-ce-9.3.6-ce.0.el7.x86_64                                                                                      2/2 

更新完毕:
 gitlab-ce.x86_64 0:9.5.9-ce.0.el7                                                                                              

完毕!

升级Gitlab(注意:由于升级不能跨越大版本号,因此只能升级到当前大版本号到最高版本,方可升级到下一个大版本号)

[root@localhost ~]# cd /var/opt/gitlab/backups/
[root@localhost backups]# ll
总用量 6532
-rw-------. 1 git git 6625280 3月 14 16:27 1552552057_2019_03_14_9.3.6_gitlab_backup.tar
-rw-------. 1 git git  61440 3月 14 16:49 1552553362_2019_03_14_9.3.6_gitlab_backup.tar

16:27 生成的tar包是我手动执行备份命令生成
16:49 生成的tar包是yum更新版本自动备份

依次执行下面指令逐步升级,在每一步安装成功后如果发现界面500,不可访问,那么执行gitlab-ctl reconfigure指令刷新配置文件。(一定保证数据可以正常访问方可执行下一步升级指令)

yum install gitlab-ce-8.17.8-ce.0.el7
yum install gitlab-ce-9.5.9-ce.0.el7
yum install gitlab-ce-10.0.0-ce.0.el7
yum install gitlab-ce-10.8.0-ce.0.el7
yum install gitlab-ce-11.3.0-ce.0.el7

查看当前版本号

[root@localhost backups]# cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
9.5.9

FAQ

[ERROR] OpenSSL::Cipher::CipherError (bad decrypt):
gitlab-rails runner "Project.where.not(import_url: nil).each { |p| p.import_data.destroy if p.import_data }"

[ERROR] Error executing action `run` on resource 'ruby_block[directory resource: /var/opt/gitlab/git-data/repositories]'
chmod -R 2770 /var/opt/gitlab/git-data

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

    您感兴趣的教程

    在docker中安装mysql详解

    本篇文章主要介绍了在docker中安装mysql详解,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编...

    详解 安装 docker mysql

    win10中文输入法仅在桌面显示怎么办?

    win10中文输入法仅在桌面显示怎么办?

    win10系统使用搜狗,QQ输入法只有在显示桌面的时候才出来,在使用其他程序输入框里面却只能输入字母数字,win10中...

    win10 中文输入法

    一分钟掌握linux系统目录结构

    这篇文章主要介绍了linux系统目录结构,通过结构图和多张表格了解linux系统目录结构,感兴趣的小伙伴们可以参考一...

    结构 目录 系统 linux

    PHP程序员玩转Linux系列 Linux和Windows安装

    这篇文章主要为大家详细介绍了PHP程序员玩转Linux系列文章,Linux和Windows安装nginx教程,具有一定的参考价值,感兴趣...

    玩转 程序员 安装 系列 PHP

    win10怎么安装杜比音效Doby V4.1 win10安装杜

    第四代杜比®家庭影院®技术包含了一整套协同工作的技术,让PC 发出清晰的环绕声同时第四代杜比家庭影院技术...

    win10杜比音效

    纯CSS实现iOS风格打开关闭选择框功能

    这篇文章主要介绍了纯CSS实现iOS风格打开关闭选择框,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作...

    css ios c

    Win7如何给C盘扩容 Win7系统电脑C盘扩容的办法

    Win7如何给C盘扩容 Win7系统电脑C盘扩容的

    Win7给电脑C盘扩容的办法大家知道吗?当系统分区C盘空间不足时,就需要给它扩容了,如果不管,C盘没有足够的空间...

    Win7 C盘 扩容

    百度推广竞品词的投放策略

    SEM是基于关键词搜索的营销活动。作为推广人员,我们所做的工作,就是打理成千上万的关键词,关注它们的质量度...

    百度推广 竞品词

    Visual Studio Code(vscode) git的使用教程

    这篇文章主要介绍了详解Visual Studio Code(vscode) git的使用,小编觉得挺不错的,现在分享给大家,也给大家做个参考。...

    教程 Studio Visual Code git

    七牛云储存创始人分享七牛的创立故事与

    这篇文章主要介绍了七牛云储存创始人分享七牛的创立故事与对Go语言的应用,七牛选用Go语言这门新兴的编程语言进行...

    七牛 Go语言

    Win10预览版Mobile 10547即将发布 9月19日上午

    微软副总裁Gabriel Aul的Twitter透露了 Win10 Mobile预览版10536即将发布,他表示该版本已进入内部慢速版阶段,发布时间目...

    Win10 预览版

    HTML标签meta总结,HTML5 head meta 属性整理

    移动前端开发中添加一些webkit专属的HTML5头部标签,帮助浏览器更好解析HTML代码,更好地将移动web前端页面表现出来...

    移动端html5模拟长按事件的实现方法

    这篇文章主要介绍了移动端html5模拟长按事件的实现方法的相关资料,小编觉得挺不错的,现在分享给大家,也给大家...

    移动端 html5 长按

    HTML常用meta大全(推荐)

    这篇文章主要介绍了HTML常用meta大全(推荐),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参...

    cdr怎么把图片转换成位图? cdr图片转换为位图的教程

    cdr怎么把图片转换成位图? cdr图片转换为

    cdr怎么把图片转换成位图?cdr中插入的图片想要转换成位图,该怎么转换呢?下面我们就来看看cdr图片转换为位图的...

    cdr 图片 位图

    win10系统怎么录屏?win10系统自带录屏详细教程

    win10系统怎么录屏?win10系统自带录屏详细

    当我们是使用win10系统的时候,想要录制电脑上的画面,这时候有人会想到下个第三方软件,其实可以用电脑上的自带...

    win10 系统自带录屏 详细教程

    + 更多教程 +
    WIN服务器linux服务器FTP服务器DNS服务器其他