CentOS7下GitLab跨大版本升级的方法
备份&升级
在升级前一定要做好备份,记录自己当前gitlab-ca的版本号。
查看当前gitlab版本号
[root@localhost~]#yumlist|grepgitlab-ce gitlab-ce.x86_649.3.6-ce.0.el7installed
备份文件
[root@localhost~]#gitlab-rakegitlab:backup:create Dumpingdatabase... DumpingPostgreSQLdatabasegitlabhq_production...[DONE] done Dumpingrepositories... *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 Dumpinguploads... done Dumpingbuilds... done Dumpingartifacts... done Dumpingpages... done Dumpinglfsobjects... done Dumpingcontainerregistryimages... [DISABLED] Creatingbackuparchive:1552552057_2019_03_14_9.3.6_gitlab_backup.tar...done Uploadingbackuparchivetoremotestorage...skipped Deletingtmpdirectories...done done done done done done done done Deletingoldbackups...skipping
在目录/var/opt/gitlab/backups/下会生成一个备份文件如:1552552057_gitlab_backup.tar,其中1552552057即为此次备份都版本号。
还原备份(失败)
gitlab-rakegitlab:backup:restoreBACKUP=备份版本号
配置gitlab-yum源
[root@localhost~]#cat</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
yuminstall安装
[root@localhost~]#yuminstallgitlab-ce-9.5.9 已加载插件:fastestmirror,langpacks gitlab-ce|2.9kB00:00:00 gitlab-ce/primary_db|2.7MB00:00:01 Loadingmirrorspeedsfromcachedhostfile *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-cex86_649.5.9-ce.0.el7gitlab-ce381M 事务概要 =============================================================================================================================================================================================================================================================== 升级1软件包 总下载量:381M Isthisok[y/d/N]:Y Downloadingpackages: NoPrestometadataavailableforgitlab-ce gitlab-ce-9.5.9-ce.0.el7.x86_6FAILED18%[==================-]659B/s|70MB137:35:05ETA https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.5.9-ce.0.el7.x86_64.rpm:[Errno12]Timeoutonhttps://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.5.9-ce.0.el7.x86_64.rpm:(28,'Operationtooslow.Lessthan1000bytes/sectransferredthelast30seconds') 正在尝试其它镜像。 gitlab-ce-9.5.9-ce.0.el7.x86_6FAILED21%[======================]646B/s|83MB134:19:56ETA https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.5.9-ce.0.el7.x86_64.rpm:[Errno12]Timeoutonhttps://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.5.9-ce.0.el7.x86_64.rpm:(28,'Operationtooslow.Lessthan1000bytes/sectransferredthelast30seconds') 正在尝试其它镜像。 gitlab-ce-9.5.9-ce.0.el7.x86_6FAILED81%[===================================================================================-]411B/s|311MB50:00:08ETA https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.5.9-ce.0.el7.x86_64.rpm:[Errno12]Timeoutonhttps://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.5.9-ce.0.el7.x86_64.rpm:(28,'Operationtooslow.Lessthan1000bytes/sectransferredthelast30seconds') 正在尝试其它镜像。 gitlab-ce-9.5.9-ce.0.el7.x86_64.rpm|381MB00:01:52 Runningtransactioncheck Runningtransactiontest Transactiontestsucceeded Runningtransaction gitlabpreinstall:AutomaticallybackinguponlytheGitLabSQLdatabase(excludingeverythingelse!) Dumpingdatabase... DumpingPostgreSQLdatabasegitlabhq_production...[DONE] done Dumpingrepositories... [SKIPPED] Dumpinguploads... [SKIPPED] Dumpingbuilds... [SKIPPED] Dumpingartifacts... [SKIPPED] Dumpingpages... [SKIPPED] Dumpinglfsobjects... [SKIPPED] Dumpingcontainerregistryimages... [DISABLED] Creatingbackuparchive:1552553362_2019_03_14_9.3.6_gitlab_backup.tar...done Uploadingbackuparchivetoremotestorage...skipped Deletingtmpdirectories...done done Deletingoldbackups...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_641/2 *.*. ****** ********** .************* **************** ,,,,,,,,,***********,,,,,,,,, ,,,,,,,,,,,*********,,,,,,,,,,, .,,,,,,,,,,,*******,,,,,,,,,,,, ,,,,,,,,,*****,,,,,,,,,. ,,,,,,,****,,,,,, .,,,***,,,, ,*,. _____________ /____(_)/_//_____//_ //__//__///__`/__\ //_////_//___//_///_// \____/_/\__/_____/\__,_/_.___/ gitlab:ThankyouforinstallingGitLab! gitlab:ToconfigureandstartGitLab,RUNTHEFOLLOWINGCOMMAND: sudogitlab-ctlreconfigure gitlab:GitLabshouldbereachableathttp://192.168.x.x:8090/gitlab gitlab:OtherwiseconfigureGitLabforyoursystembyediting/etc/gitlab/gitlab.rbfile gitlab:Andrunningreconfigureagain. gitlab: gitlab:ForacomprehensivelistofconfigurationoptionspleaseseetheOmnibusGitLabreadme gitlab:https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md gitlab: 清理:gitlab-ce-9.3.6-ce.0.el7.x86_642/2 CheckingPostgreSQLexecutables:OK ShuttingdownallGitLabservicesexceptthoseneededformigrations ok:down:gitaly:1s,normallyup ok:down:gitlab-monitor:0s,normallyup ok:down:gitlab-workhorse:1s,normallyup ok:down:logrotate:0s,normallyup ok:down:nginx:1s,normallyup ok:down:node-exporter:0s,normallyup ok:down:postgres-exporter:0s,normallyup ok:down:postgresql:0s,normallyup ok:down:prometheus:0s,normallyup ok:down:redis:1s,normallyup ok:down:redis-exporter:0s,normallyup ok:down:sidekiq:0s,normallyup ok:down:unicorn:0s,normallyup ok:run:postgresql:(pid3362)1s ok:run:redis:(pid3370)0s run:postgresql:(pid3362)1s;run:log:(pid866)3488369s run:redis:(pid3370)0s;run:log:(pid897)3488369s ReconfiguringGitLabtoapplymigrations *Movingexistingcertificatesfoundin/opt/gitlab/embedded/ssl/certs *Symlinkingexistingcertificatesfoundin/etc/gitlab/trusted-certs gitlabReconfigured! Checkingforanomnibusmanagedpostgresql:OK Checkingifwealreadyupgraded:OK Thelatestversion9.6.3isalreadyrunning,nothingtodo EnsuringPostgreSQLisupdated:OK RestartingpreviouslyrunningGitLabservices ok:run:gitaly:(pid4046)2s ok:run:gitlab-monitor:(pid4086)1s ok:run:gitlab-workhorse:(pid4068)2s ok:run:logrotate:(pid4120)1s ok:run:nginx:(pid4126)0s ok:run:node-exporter:(pid4177)0s ok:run:postgres-exporter:(pid4184)1s ok:run:postgresql:(pid3362)72s ok:run:prometheus:(pid4094)3s ok:run:redis:(pid3370)71s ok:run:redis-exporter:(pid4194)0s ok:run:sidekiq:(pid4203)1s ok:run:unicorn:(pid4216)0s Upgradecomplete!IfyourGitLabserverismisbehavingtryrunning sudogitlab-ctlrestart beforeanythingelse.Ifyouneedtorollbacktothepreviousversionyoucan usethedatabasebackupmadeduringtheupgrade(scrollupforthefilename). 验证中:gitlab-ce-9.5.9-ce.0.el7.x86_641/2 验证中:gitlab-ce-9.3.6-ce.0.el7.x86_642/2 更新完毕: gitlab-ce.x86_640:9.5.9-ce.0.el7 完毕!
升级Gitlab(注意:由于升级不能跨越大版本号,因此只能升级到当前大版本号到最高版本,方可升级到下一个大版本号)
[root@localhost~]#cd/var/opt/gitlab/backups/ [root@localhostbackups]#ll 总用量6532 -rw-------.1gitgit66252803月1416:271552552057_2019_03_14_9.3.6_gitlab_backup.tar -rw-------.1gitgit614403月1416:491552553362_2019_03_14_9.3.6_gitlab_backup.tar 16:27生成的tar包是我手动执行备份命令生成 16:49生成的tar包是yum更新版本自动备份
依次执行下面指令逐步升级,在每一步安装成功后如果发现界面500,不可访问,那么执行gitlab-ctlreconfigure指令刷新配置文件。(一定保证数据可以正常访问方可执行下一步升级指令)
yuminstallgitlab-ce-8.17.8-ce.0.el7 yuminstallgitlab-ce-9.5.9-ce.0.el7 yuminstallgitlab-ce-10.0.0-ce.0.el7 yuminstallgitlab-ce-10.8.0-ce.0.el7 yuminstallgitlab-ce-11.3.0-ce.0.el7
查看当前版本号
[root@localhostbackups]#cat/opt/gitlab/embedded/service/gitlab-rails/VERSION 9.5.9
FAQ
[ERROR]OpenSSL::Cipher::CipherError(baddecrypt): gitlab-railsrunner"Project.where.not(import_url:nil).each{|p|p.import_data.destroyifp.import_data}" [ERROR]Errorexecutingaction`run`onresource'ruby_block[directoryresource:/var/opt/gitlab/git-data/repositories]' chmod-R2770/var/opt/gitlab/git-data
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持毛票票。
声明:本文内容来源于网络,版权归原作者所有,内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现有涉嫌版权的内容,欢迎发送邮件至:czq8825#qq.com(发邮件时,请将#更换为@)进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。