最近在对RocketMQ集群加入broker的时候,启动RocketMQ报错
[1] 1662
[root@localhost rocketmq]# Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000005c0000000, 8589934592, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 8589934592 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /usr/local/software/rocketmq/hs_err_pid1669.log
意思就是本地的内存比所配置的内存少,导致内存无法分配而报错
修改配置的内存即可
调整Name Server的内存 (默认是 JAVA_OPT="${JAVA_OPT} -server -Xms4g -Xmx4g -Xmn2g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m")
修改runserver.sh
JAVA_OPT="${JAVA_OPT} -server -Xms2g -Xmxg -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
调整broker的内存(默认是 JAVA_OPT="${JAVA_OPT} -server -Xms8g -Xmx8g -Xmn4g")
修改runbroker.sh
JAVA_OPT="${JAVA_OPT} -server -Xms2g -Xmx2g -Xmn1g"