按照gitlab官方的升级路线,从15.11.13版本升级到16.3.9版本时,报如下错误

[root@gitlab temp]# rpm -Uvh gitlab-ce-16.3.9-ce.0.el7.x86_64.rpm 
warning: gitlab-ce-16.3.9-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
Preparing...                          ################################# [100%]
gitlab preinstall: 
gitlab preinstall: Your version of PostgreSQL is no longer supported. Please upgrade your PostgreSQL version to 13.
gitlab preinstall: Check https://docs.gitlab.com/omnibus/settings/database.html#upgrade-packaged-postgresql-server for details.
gitlab preinstall: 
gitlab preinstall: Upgrade failed. Retry the upgrade after upgrading your PostgreSQL version.
error: %pre(gitlab-ce-16.3.9-ce.0.el7.x86_64) scriptlet failed, exit status 1
error: gitlab-ce-16.3.9-ce.0.el7.x86_64: install failed
error: gitlab-ce-15.11.13-ce.0.el7.x86_64: erase skipped

根据报错信息,可以看到16版本要求PostgreSQL的版本最低为13,需要单独对PostgreSQL进行升级,执行gitlab-ctl pg-upgrade​单独升级postgresql,输出如下:

[root@gitlab temp]# gitlab-ctl pg-upgrade
Checking for an omnibus managed postgresql: OK
Checking if postgresql['version'] is set: OK
Checking if we already upgraded: NOT OK
Checking for a newer version of PostgreSQL to install
Upgrading PostgreSQL to 13.11
Checking if disk for directory /data/gitlab/postgresql/data has enough free space for PostgreSQL upgrade: OK
Checking if PostgreSQL bin files are symlinked to the expected location: OK
Waiting 30 seconds to ensure tasks complete before PostgreSQL upgrade.
See https://docs.gitlab.com/omnibus/settings/database.html#upgrade-packaged-postgresql-server for details
If you do not want to upgrade the PostgreSQL server at this time, enter Ctrl-C and see the documentation for details

Please hit Ctrl-C now if you want to cancel the operation.
Toggling deploy page:cp /opt/gitlab/embedded/service/gitlab-rails/public/deploy.html /opt/gitlab/embedded/service/gitlab-rails/public/index.html
Toggling deploy page: OK
Toggling services:ok: down: alertmanager: 1s, normally up
ok: down: gitaly: 0s, normally up
ok: down: gitlab-exporter: 0s, normally up
ok: down: gitlab-kas: 0s, normally up
ok: down: grafana: 0s, normally up
ok: down: logrotate: 1s, normally up
ok: down: node-exporter: 0s, normally up
ok: down: postgres-exporter: 1s, normally up
ok: down: prometheus: 0s, normally up
ok: down: redis-exporter: 1s, normally up
ok: down: sidekiq: 0s, normally up
Toggling services: OK
Running stop on postgresql:ok: down: postgresql: 0s, normally up
Running stop on postgresql: OK
Symlink correct version of binaries: OK
Creating temporary data directory: OK
Initializing the new database: OK
Upgrading the data: OK
Move the old data directory out of the way: OK
Rename the new data directory: OK
Saving the old version information: OK
Configuring PostgreSQL
[2024-12-26T15:10:09+08:00] INFO: Started Cinc Zero at chefzero://localhost:1 with repository at /opt/gitlab/embedded (One version per cookbook)
Cinc Client, version 17.10.0
Patents: https://www.chef.io/patents
Infra Phase starting
[2024-12-26T15:10:09+08:00] INFO: *** Cinc Client 17.10.0 ***
[2024-12-26T15:10:09+08:00] INFO: Platform: x86_64-linux
[2024-12-26T15:10:09+08:00] INFO: Cinc-client pid: 685
[2024-12-26T15:10:11+08:00] INFO: Setting the run_list to ["recipe[gitlab::config]", "recipe[postgresql::enable]"] from CLI options
[2024-12-26T15:10:11+08:00] INFO: Run List is [recipe[gitlab::config], recipe[postgresql::enable]]
[2024-12-26T15:10:11+08:00] INFO: Run List expands to [gitlab::config, postgresql::enable]
[2024-12-26T15:10:11+08:00] INFO: Starting Cinc Client Run for gitlab.link-x.host
[2024-12-26T15:10:11+08:00] INFO: Running start handlers
[2024-12-26T15:10:11+08:00] INFO: Start handlers complete.
Resolving cookbooks for run list: ["gitlab::config", "postgresql::enable"]
[2024-12-26T15:10:12+08:00] INFO: Loading cookbooks [gitlab@0.0.1, postgresql@0.1.0, package@0.1.0, logrotate@0.1.0, redis@0.1.0, monitoring@0.1.0, registry@0.1.0, mattermost@0.1.0, consul@0.1.0, gitaly@0.1.0, praefect@0.1.0, gitlab-kas@0.1.0, gitlab-pages@0.1.0, letsencrypt@0.1.0, nginx@0.1.0, runit@5.1.7, acme@4.1.6, crond@0.1.0]
Synchronizing cookbooks:
  - gitlab (0.0.1)
  - postgresql (0.1.0)
  - package (0.1.0)
  - logrotate (0.1.0)
  - redis (0.1.0)
  - monitoring (0.1.0)
  - registry (0.1.0)
  - mattermost (0.1.0)
  - consul (0.1.0)
  - gitaly (0.1.0)
  - praefect (0.1.0)
  - gitlab-kas (0.1.0)
  - gitlab-pages (0.1.0)
  - letsencrypt (0.1.0)
  - nginx (0.1.0)
  - runit (5.1.7)
  - acme (4.1.6)
  - crond (0.1.0)
Installing cookbook gem dependencies:
Compiling cookbooks...
Loading Cinc Auditor profile files:
Loading Cinc Auditor input files:
Loading Cinc Auditor waiver files:
Converging 27 resources
Recipe: postgresql::bin
  * ruby_block[check_postgresql_version] action run (skipped due to not_if)
  * ruby_block[check_postgresql_version_is_deprecated] action run (skipped due to not_if)
  * ruby_block[Link postgresql bin files to the correct version] action run (skipped due to only_if)
  * template[/opt/gitlab/etc/gitlab-psql-rc] action create (up to date)
Recipe: postgresql::user

#.....中间略......

Recipe: gitlab::database_reindexing_disable
  * crond_job[database-reindexing] action delete
    * file[/var/opt/gitlab/crond/database-reindexing] action delete (up to date)
     (up to date)
[2024-12-26T15:11:17+08:00] INFO: Cinc Client Run complete in 53.157655378 seconds

Running handlers:
[2024-12-26T15:11:17+08:00] INFO: Running report handlers
Running handlers complete
[2024-12-26T15:11:17+08:00] INFO: Report handlers complete
Infra Phase complete, 4/849 resources updated in 54 seconds
[2024-12-26T15:11:17+08:00] WARN: This release of Cinc Client became end of life (EOL) on May 1st 2023. Please update to a supported release to receive new features, bug fixes, and security updates.
Running reconfigure: OK
Waiting for Database to be running.
Database upgrade is complete, running vacuumdb analyze
Toggling deploy page:rm -f /opt/gitlab/embedded/service/gitlab-rails/public/index.html
Toggling deploy page: OK
Toggling services:ok: run: alertmanager: (pid 1575) 0s
ok: run: gitaly: (pid 1586) 1s
ok: run: gitlab-exporter: (pid 1611) 0s
ok: run: gitlab-kas: (pid 1613) 0s
ok: run: grafana: (pid 1623) 1s
ok: run: logrotate: (pid 1635) 0s
ok: run: node-exporter: (pid 1643) 1s
ok: run: postgres-exporter: (pid 1649) 0s
ok: run: prometheus: (pid 1657) 1s
ok: run: redis-exporter: (pid 1667) 0s
ok: run: sidekiq: (pid 1675) 0s
Toggling services: OK
==== Upgrade has completed ====
Please verify everything is working and run the following if so
sudo rm -rf /data/gitlab/postgresql/data.12
sudo rm -f /var/opt/gitlab/postgresql-version.old

完成postgresql升级后,就可以重新进行gitlab的升级操作了。

最后修改:2024 年 12 月 26 日
如果觉得我的文章对你有用,请随意赞赏