rocketmq搭建的时候内存不足的问题

由于我使用的是虚拟机,所以内存不太够,造成了问题。

问题

按照官网使用的时候,启动broker的时候,除了内存不够的报警

[root@localhost apache-rocketmq]# sh bin/mqbroker -n localhost:9876
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/rocketmq-all-4.4.0/distribution/target/apache-rocketmq/hs_err_pid1756.log

解决

vim bin/runserver.sh ## 记住这个是编译之前改源码里面的改完再次编译,或者直接改编译后的配置
修改内存
JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn512m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
vim bin/runbroker.sh
修改内存
JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn512g"

你可能感兴趣的:(运维)