每天进行 gitlab 备份后,gitlab 都会抛出 502 错误。 我看到了 nginx 日志,但没有找到那么多信息。
在 gitlab-ctl restart
之后它又开始工作了。
系统配置: 操作系统:Ubuntu 16.04 LTS 4 GB 内存 200 GB 磁盘空间
谁能给出永久解决方案。
最佳答案
它很可能会耗尽共享内存。每次备份后都会出现 502 错误。
用gitlab-ctl tail
检查tail detail
它将显示如下内容:
2019-04-12_12:37:17.27154 FATAL: could not map anonymous shared memory: Cannot allocate memory
2019-04-12_12:37:17.27157 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 4345470976 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
2019-04-12_12:37:17.27171 LOG: database system is shut down
然后用free -m
查看,没有可用的共享内存。
total used free shared buffers cached
Mem: 16081 13715 2365 0 104 753
-/+ buffers/cache: 12857 3223
然后你需要检查是否有一些进程占用了太多的共享内存,或者太多的 zomibe 进程,然后用 ps -aef | 之类的命令杀死它。 grep ffmpeg | awk '{print $2}' | xargs 杀死 9
用free -h
查看,现在有大约112M
的共享内存。
total used free shared buffers cached
Mem: 15G 4.4G 11G 112M 46M 416M
-/+ buffers/cache: 3.9G 11G
Swap: 0B 0B 0B
最后,用 gitlab-ctl restart
重启你的 gitlab,一段时间后 gitlab 启动,502 消失了。
关于nginx - 502 Gitlab 响应时间过长,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40467664/