您好,登錄后才能下訂單哦!
這篇文章主要介紹“CentOS7下GitLab怎么跨大版本升級”的相關知識,小編通過實際案例向大家展示操作過程,操作方法簡單快捷,實用性強,希望這篇“CentOS7下GitLab怎么跨大版本升級”文章能幫助大家解決問題。
備份&升級
在升級前一定要做好備份,記錄自己當前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
關于“CentOS7下GitLab怎么跨大版本升級”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識,可以關注億速云行業資訊頻道,小編每天都會為大家更新不同的知識點。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。