gitlab ce 11.11.5升级遇到问题

环境:centos7
软件版本:gitlab ce 11.11.5

11.11.5 备份时候,备份失败!卡在特定的仓库。如何检查仓库的有效性啊?
11.11.8上,运行gitlab-ctl pg-upgrade报如下错误:
gitlab-ctl pg-upgrade
Checking for an omnibus managed postgresql: OK
Checking for a newer version of PostgreSQL to install
Upgrading PostgreSQL to 10.7
Checking if we already upgraded: NOT OK
Checking if PostgreSQL bin files are symlinked to the expected location: OK
Waiting 30 seconds to ensure tasks complete before PostgreSQL upgrade.

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: 0s, normally up
ok: down: gitaly: 0s, normally up
ok: down: gitlab-monitor: 0s, normally up, want up
ok: down: gitlab-pages: 0s, normally up
ok: down: logrotate: 1s, normally up
ok: down: postgres-exporter: 0s, normally up
ok: down: prometheus: 1s, normally up
ok: down: redis-exporter: 0s, normally up
ok: down: sidekiq: 1s, normally up
Toggling services: OK
Traceback (most recent call last):
10: from /opt/gitlab/embedded/bin/omnibus-ctl:23:in <main>' 9: from /opt/gitlab/embedded/bin/omnibus-ctl:23:in load’
8: from /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/omnibus-ctl-0.6.0/bin/omnibus-ctl:31:in <top (required)>' 7: from /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/omnibus-ctl-0.6.0/lib/omnibus-ctl.rb:746:in run’
6: from /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/omnibus-ctl-0.6.0/lib/omnibus-ctl.rb:204:in block in add_command_under_category' 5: from /opt/gitlab/embedded/service/omnibus-ctl/pg-upgrade.rb:140:in block in load_file’
4: from /opt/gitlab/embedded/service/omnibus-ctl/pg-upgrade.rb:194:in general_upgrade' 3: from /opt/gitlab/embedded/service/omnibus-ctl/pg-upgrade.rb:148:in common_pre_upgrade’
2: from /opt/gitlab/embedded/service/omnibus-ctl/lib/gitlab_ctl/pg_upgrade.rb:35:in tmp_data_dir' 1: from /opt/gitlab/embedded/service/omnibus-ctl/lib/gitlab_ctl/pg_upgrade.rb:30:in data_dir’
/opt/gitlab/embedded/service/omnibus-ctl/lib/gitlab_ctl/pg_upgrade.rb:30:in `realpath’: No such file or directory @ realpath_rec - /var/opt/gitlab/postgresql/data (Errno::ENOENT)

当前pg的数据是放在/data/gitlab/postgresql/下:
gitlab.rb中的配置:
postgresql[‘dir’] = “/data/gitlab/postgresql”
postgresql[‘log_directory’] = “/data/gitlab/postgresql”
postgresql[‘home’] = “/data/gitlab/postgresql”

创建软连接后执行数据库升级

sudo ln -s /export/gitlab/postgresql/data /var/opt/gitlab/postgresql/data

sudo gitlab-ctl pg-upgrade

gitlab-ctl pg-upgrade
Checking for an omnibus managed postgresql: OK
Checking for a newer version of PostgreSQL to install
Upgrading PostgreSQL to 10.7
Checking if we already upgraded: NOT OK
Checking if PostgreSQL bin files are symlinked to the expected location: OK
Waiting 30 seconds to ensure tasks complete before PostgreSQL upgrade.

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-monitor: 0s, normally up, want up
ok: down: gitlab-pages: 1s, normally up
ok: down: logrotate: 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
Stopping the database:ok: down: postgresql: 0s, normally up
Stopping the database: OK
Symlink correct version of binaries: OK
Creating temporary data directory:Traceback (most recent call last):
14: from /opt/gitlab/embedded/bin/omnibus-ctl:23:in <main>' 13: from /opt/gitlab/embedded/bin/omnibus-ctl:23:in load’
12: from /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/omnibus-ctl-0.6.0/bin/omnibus-ctl:31:in <top (required)>' 11: from /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/omnibus-ctl-0.6.0/lib/omnibus-ctl.rb:746:in run’
10: from /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/omnibus-ctl-0.6.0/lib/omnibus-ctl.rb:204:in block in add_command_under_category' 9: from /opt/gitlab/embedded/service/omnibus-ctl/pg-upgrade.rb:140:in block in load_file’
8: from /opt/gitlab/embedded/service/omnibus-ctl/pg-upgrade.rb:194:in general_upgrade' 7: from /opt/gitlab/embedded/service/omnibus-ctl/pg-upgrade.rb:152:in common_pre_upgrade’
6: from /opt/gitlab/embedded/service/omnibus-ctl/pg-upgrade.rb:226:in create_temp_data_dir' 5: from /opt/gitlab/embedded/service/omnibus-ctl/pg-upgrade.rb:383:in progress_message’
4: from /opt/gitlab/embedded/service/omnibus-ctl/pg-upgrade.rb:228:in block in create_temp_data_dir' 3: from /opt/gitlab/embedded/service/omnibus-ctl/lib/gitlab_ctl/pg_upgrade.rb:39:in run_pg_command’
2: from /opt/gitlab/embedded/service/omnibus-ctl/lib/gitlab_ctl/util.rb:56:in get_node_attributes' 1: from /opt/gitlab/embedded/service/omnibus-ctl/lib/gitlab_ctl/util.rb:42:in parse_json_file’
/opt/gitlab/embedded/service/omnibus-ctl/lib/gitlab_ctl/util.rb:42:in `read’: No such file or directory @ rb_sysopen - /opt/gitlab/embedded/nodes/.json (Errno::ENOENT)

直接运行升级程序,报错如下:
rpm -Uvh /nfs_share/soft/gitlab-ce-12.0.12-ce.0.el7.x86_64.rpm > /nfs_share/upgrade-12-0-12.log
warning: /nfs_share/soft/gitlab-ce-12.0.12-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
pg_dump: [archiver (db)] connection to database “gitlabhq_production” failed: could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket “/data/gitlab/postgresql/.s.PGSQL.5432”?
rake aborted!
Backup::Error: Backup failed
/opt/gitlab/embedded/service/gitlab-rails/lib/backup/database.rb:50:in dump' /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:99:in block (4 levels) in <top (required)>’
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:10:in block (3 levels) in <top (required)>' /opt/gitlab/embedded/bin/bundle:23:in load’
/opt/gitlab/embedded/bin/bundle:23:in `’
Tasks: TOP => gitlab:backup:db:create
(See full trace by running task with --trace)
error: %pre(gitlab-ce-12.0.12-ce.0.el7.x86_64) scriptlet failed, exit status 1
error: gitlab-ce-12.0.12-ce.0.el7.x86_64: install failed
error: gitlab-ce-11.11.8-ce.0.el7.x86_64: erase skipped

做了软连接之后rpm升级失败可能是因为备份程序检测到pg未运行,无法备份pg:

pg_dump: [archiver (db)] connection to database “gitlabhq_production” failed: could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket “/data/gitlab/postgresql/.s.PGSQL.5432”?

多谢多谢!
通过快照恢复到11.11.8修改前的状态后,建立软连接后重新升级
命令:
vim /etc/gitlab/gitlab.rb
注释掉:
postgresql[‘data_dir’] = “/data/gitlab/postgresql/data”
然后sudo ln -s /data/gitlab/postgresql/data /var/opt/gitlab/postgresql/data
rpm -Uvh /nfs_share/soft/gitlab-ce-12.0.12-ce.0.el7.x86_64.rpm > /nfs_share/upgrade-12-0-12.log

日志提示:
Ensuring PostgreSQL is updated: NOT OK
Error ensuring PostgreSQL is updated. Please check the logs

此时再进行数据库的升级
sudo gitlab-ctl pg-upgrade

1 个赞

数据库的坑过去后,后面的升级比较容易了