第三组广告

解决Nexus由于内存不足,造成启动失败问题(3.X版本)

1,问题描述

(1)之前在服务器上部署了个 Nexus 服务,突然无法访问(http://IP:8081/),重启服务依旧没能解决问题。执行如下命令结果为空,说明 8081 端口未被占用,也就是说 Nexus 服务实际上并没有启动。
1
lsof -i:8081
原文:解决Nexus由于内存不足,造成启动失败问题(3.X版本)

(2)在 Nexus 的 bin 文件夹下执行如下命令查看服务状态:
1
./nexus status

(3)显示如下信息,说明由于内存不足造成的:
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 419430400 bytes for committing reserved memory.
# Possible reasons:
#     The system is out of physical RAM or swap space
#     In 32 bit mode, the process size limit was hit
# Possible solutions:
#     Reduce memory load on the system
#     Increase physical memory or swap space
#     Check if swap backing store is full
#     Use 64 bit Java on a 64 bit OS
#     Decrease Java heap size (-Xmx/-Xms)
#     Decrease number of Java threads
#     Decrease Java thread stack sizes (-Xss)
#     Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
#    Out of Memory Error (os_linux.cpp:2640), pid=9927, tid=0x00007fdb4a672700
#
# JRE version: (8.0_151-b12) (build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.151-b12 mixed mode linux-amd64 compressed oops)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
 

2,解决办法

(1)编辑 nexus.vmoptions 文件(在 Nexus 文件夹中的 bin 目录下):
1
vi nexus.vmoptions

(2)修改 Nexus 的内存配置即可:
1
2
3
-Xms128M
-Xmx128M
-XX:MaxDirectMemorySize=256M

您可能还会对下面的文章感兴趣: