HTTP 502: Whoops, GitLab is taking too much time to respond.
一、错误信息
二、排错过程
1、启动 unicorn 未监听端口
日志路径 : /var/log/gitlab/unicorn/unicorn_stderr.log
PG::ConnectionBad: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"? /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `initialize' /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `new' /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect' /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize' /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new' /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection' ··· ··· ··· ···
信息显示是因为连不上PG,所以启动 postgresql 后重启即可正常(嗯,是酱)。。
2、postgresql down
down: postgresql: 0s, normally up, want up; run: log: (pid 623) 15816094s
通过 PG 的日志路径 : /var/log/gitlab/postgresql/current 可以查看到如下信息
2018-11-01_08:18:09.49669 FATAL: could not map anonymous shared memory: Cannot allocate memory 2018-11-01_08:18:09.49671 HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 4292984832 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections. 2018-11-01_08:18:09.49671 LOG: database system is shut down
也可以通过命令 `gitlab-ctl tail postgresql`,得到一样的信息,于是可以确定问题。。
This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 4292984832 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections. 2018-11-01_07:52:06.63024 LOG: database system is shut down
于是在配置文件中对 postgresql 的 shared_buffers 和 max_connections 两项进行了限制
[root@V2 ~]# cat /etc/gitlab/gitlab.rb |grep -v ^$ |grep -v ^# external_url 'http://xxx.xxx.xxx.xxx.xxx:8090' unicorn['worker_timeout'] = 60 unicorn['worker_processes'] = 3 unicorn['listen'] = 'xxx.xxx.xxx.xxx.xxx' unicorn['port'] = 8870 postgresql['enable'] = true postgresql['data_dir'] = "/var/opt/gitlab/postgresql/data" postgresql['shared_buffers'] = "256MB" # ! **recommend value is 1/4 of total RAM, up to 14GB.** postgresql['max_connections'] = 200 nginx['listen_addresses'] = ['*'] nginx['listen_port'] = 8090
配置完成保存,之后更新配置,重启应用即可。
gitlab-ctl reconfigure # 更新配置 gitlab-ctl restart # 重启应用 gitlab-ctl status # 查看服务状态

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
使用的ssm框架 Java 上传图片到专有云OSS
测试上传图片到阿里云
- 下一篇
牛逼哄哄的 RPC 框架,底层到底什么原理?
1. RPC框架的概念 RPC(Remote Procedure Call)–远程过程调用,通过网络通信调用不同的服务,共同支撑一个软件系统,微服务实现的基石技术。 使用RPC可以解耦系统,方便维护,同时增加系统处理请求的能力。 上面是一个简单的软件系统结构,我们拆分出来用户系统和订单系统做为服务存在,让不同的站点去调用。 只需要引入各个服务的接口包,在代码中调用RPC服务就跟调用本地方法一样,我刚接触到这种调用方式的时候颇为惊奇,我明明调用的就是java语言方法啊(已java为例,现在RPC框架一般都支持多语言),怎么就调用了远程的服务了呢?? 2. RPC框架的原理解析 最近自己写了一个简单的RPC框架KRPC,本文原理分析结合中代码,均为该框架源码,RPC与RMI的区别看这篇文章《Java RMI 和 RPC 的区别》。 2.1 流程纵览 如上图所示,我将一个RPC调用流程概括为上图中5个流程,左边3个为客户端流程,右边两个为服务端流程。 下面就各流程进行解析 2.2 客户端调用 服务调用方在调用服务时,一般进行相关初始化,通过配置文件/配置中心 获取服务端地址用户调用。 //用...
相关文章
文章评论
共有0条评论来说两句吧...