记:处理一次gitlab占用cpu过高的问题

2022-02-14  本文已影响0人  SILENCE_SPEAKS
1. 编辑配置文件
cd /etc/gitlab
vi gitlab.rb  

2. 配置文件中调整参数如下:
gitlab_rails['time_zone'] = 'Asia/Shanghai'
unicorn['worker_processes'] = 2
unicorn['worker_memory_limit_min'] = "100 * 1 << 20"
unicorn['worker_memory_limit_max'] = "250 * 1 << 20"
sidekiq['concurrency'] = 8
postgresql['shared_buffers'] = "128MB"
postgresql['max_worker_processes'] = 4
prometheus_monitoring['enable'] = false

3. 应用更改后的配置、重启gitlab
gitlab-ctl reconfigure
gitlab-ctl restart

注:运行gitlab-ctl reconfigure命令可能遇到的问题

There was an error running gitlab-ctl reconfigure:

Multiple failures occurred:
* Mixlib::ShellOut::ShellCommandFailed occurred in chef run: runit_service[gitlab-workhorse] (gitlab::gitlab-workhorse line 49) had an error: Mixlib::ShellOut::ShellCommandFailed: ruby_block[reload_log_service] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/runit/libraries/provider_runit_service.rb line 77) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /opt/gitlab/embedded/bin/sv force-reload /opt/gitlab/service/gitlab-workhorse/log ----
STDOUT: kill: run: /opt/gitlab/service/gitlab-workhorse/log: (pid 2093) 22549915s, got TERM
STDERR: 
---- End output of /opt/gitlab/embedded/bin/sv force-reload /opt/gitlab/service/gitlab-workhorse/log ----
Ran /opt/gitlab/embedded/bin/sv force-reload /opt/gitlab/service/gitlab-workhorse/log returned 1
* Mixlib::ShellOut::ShellCommandFailed occurred in delayed notification: execute[clear the gitlab-rails cache] (gitlab::gitlab-rails line 409) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received ''
---- Begin output of /opt/gitlab/bin/gitlab-rake cache:clear ----
STDOUT: 
STDERR: 
---- End output of /opt/gitlab/bin/gitlab-rake cache:clear ----
Ran /opt/gitlab/bin/gitlab-rake cache:clear returned 

解决办法:
1.gitlab进行gitlab-ctl reconfigure的时候,碰到问题:

bash[migrate gitlab-rails database] (gitlab::database_migrations line 55) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1' 

报错database_migrations问题涉及数据库。使用gitlab-ctl stop停止gitlab服务,执行如下命令后重启gitlab即可,命令如下:

chmod 0755 /var/opt/gitlab/postgresql
systemctl restart gitlab-runsvdir
#重启gitlab
gitlab-ctl reconfigure
gitlab-ctl restart

2.在启动gitlab的时候访问是会提示502 Whoops, GitLab is taking too much time to respond. 开始以为是服务出了问题,实际这是一个正常的过程,此问题说明gitlab正在启动,消耗内存中,还没有启动完成!这时不要去修改端口,启动等,等待一下即可。

3.项目数据备份时gitlab-rake gitlab:backup:create提示:Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data and are not included in this backup. You will need these files to restore a backup. Please back them up manually.
此部分表示 gitlab.rb 和 gitlab-secrets.json 两个文件包含敏感信息,未被备份到备份文件中,需要手动备份。

转载:http://www.mairoot.com/?p=2689
转载:http://www.04007.cn/article/1039.html

上一篇下一篇

猜你喜欢

热点阅读