Gitlab页面报500错误
2021-08-20 本文已影响0人
无味wy
场景:gitlab从12.0版本升级到12.1版本后又经行了汉化,访问web页面报错500

查看日志tail -f /var/log/gitlab/gitlab-rails/production.log
没有问题
="postgres_exporter.go:1035"
2019-10-20_09:13:02.01971 time="2019-10-20T17:13:02+08:00" level=info msg="Semantic Version Changed: 0.0.0 -> 10.7.0" source="postgres_exporter.go:965"
2019-10-20_09:13:02.07282 time="2019-10-20T17:13:02+08:00" level=info msg="Starting Server: localhost:9187" source="postgres_exporter.go:1178"
==> /var/log/gitlab/grafana/current <==
2019-10-20_09:13:00.46395 t=2019-10-20T17:13:00+0800 lvl=info msg="Initializing RemoteCache" logger=server
2019-10-20_09:13:00.46395 t=2019-10-20T17:13:00+0800 lvl=info msg="Initializing ServerLockService" logger=server
2019-10-20_09:13:00.46395 t=2019-10-20T17:13:00+0800 lvl=info msg="Initializing TracingService" logger=server
2019-10-20_09:13:00.46395 t=2019-10-20T17:13:00+0800 lvl=info msg="Initializing UsageStatsService" logger=server
2019-10-20_09:13:00.46395 t=2019-10-20T17:13:00+0800 lvl=info msg="Initializing UserAuthTokenService" logger=server
2019-10-20_09:13:00.46396 t=2019-10-20T17:13:00+0800 lvl=info msg="Initializing CleanUpService" logger=server
2019-10-20_09:13:00.46396 t=2019-10-20T17:13:00+0800 lvl=info msg="Initializing NotificationService" logger=server
2019-10-20_09:13:00.46397 t=2019-10-20T17:13:00+0800 lvl=info msg="Initializing ProvisioningService" logger=server
2019-10-20_09:13:00.57375 t=2019-10-20T17:13:00+0800 lvl=info msg="Initializing Stream Manager"
2019-10-20_09:13:00.57377 t=2019-10-20T17:13:00+0800 lvl=info msg="HTTP Server Listen" logger=http.server address=localhost:3000 protocol=http subUrl=/-/grafana socket=
查看服务状态也没有问题
[root@backup ~]# gitlab-ctl status
run: alertmanager: (pid 15178) 1363s; run: log: (pid 7440) 3736s
run: gitaly: (pid 15192) 1361s; run: log: (pid 7422) 3736s
run: gitlab-monitor: (pid 15197) 1361s; run: log: (pid 7454) 3736s
run: gitlab-workhorse: (pid 15211) 1361s; run: log: (pid 7427) 3736s
run: grafana: (pid 15225) 1360s; run: log: (pid 7460) 3736s
run: logrotate: (pid 15240) 1360s; run: log: (pid 7435) 3736s
run: nginx: (pid 15246) 1359s; run: log: (pid 7446) 3736s
run: node-exporter: (pid 15262) 1359s; run: log: (pid 7438) 3736s
run: postgres-exporter: (pid 15269) 1359s; run: log: (pid 7442) 3736s
run: postgresql: (pid 15287) 1358s; run: log: (pid 7448) 3736s
run: redis: (pid 15312) 1357s; run: log: (pid 7419) 3737s
run: redis-exporter: (pid 15321) 1357s; run: log: (pid 7450) 3736s
run: sidekiq: (pid 16966) 1075s; run: log: (pid 7445) 3736s
run: unicorn: (pid 17432) 1012s; run: log: (pid 7444) 3736s
查资料得知,GitLab发现报500错误,大意为DB数据关系错误,需要升级数据库关系
查看数据库状态
sudo gitlab-rake db:migrate:status
发现有些显示为down了
up 20190702173936 Populate remaining merge request assignees
up 20190703130053 Remove gitaly feature flags
up 20190703185326 Fix wrong pages access level
up 20190709204413 Add rule type to approval project rules
up 20190710151229 Add index to approval project rules rule type
up 20190715114644 Drop project features pages access level default
down 20190719122333 Add login recaptcha protection enabled to application settings
down 20190816151221 Add active jobs limit to plans
再执行下面命令,升级数据库关系
gitlab-rake db:migrate
gitlab-ctl reconfigure #再加载
再次访问就可以访问到了
场景:gitlab12.3.5版本进行了汉化,冷迁移后 访问web页面报错500
查看gitlab-ctl status
状态报错,redis down
Error connecting to Redis on /var/opt/gitlab/redis/redis.socket (Errno::ECONNREFUS
查看日志
[root@gitlab redis]# tailf /var/log/gitlab/gitlab-rails/production.log
Redis : :CannotConnectError (Error connecting to Redis on /var/opt/gitlab/ redis/ redis . socket (Errno : :ECONNREFUSED)):
config/ initializers/8 metrics. rb :224:in connect
lib/gitlab/middLewa re/multipart. rb:97:in call
lib/gitlab/ request profiler/middLeware. rb:14:in call'
ee/lib/gitlab/ jira/middLeware. rb:15:in call'
解决办法:
#停掉gitlab
gitlab-ctl stop
#删除文件(最好备份下)
rm -rf /var/opt/gitlab/redis/dump.rdb
#启动gitlab
gitlab-ctl start