[root@iZwz94sw188z3yfl7lpmmsZ apache-rocketmq]# sh bin/mqnamesrvJava HotSpot(TM) 64-Bit Server VM warning: Using the DefNewyoung collector with the CMS collector is deprecated and willlikely be removed in a future releaseJava HotSpot(TM) 64-Bit Server VM warning:UseCMSCompactAtFullCollection is deprecated and will likely beremoved in a future release.Java HotSpot(TM) 64-Bit Server VM warning: INFO:os::commit_memory(0x00000006ec800000, 2147483648, 0) failed;error='Cannot allocate memory' (errno=12)## There is insufficient memory for the Java Runtime Environmentto continue.# Native memory allocation (mmap) failed to map 2147483648 bytesfor committing reserved memory.# An error report file with more information is saved as:# /usr/local/software/rocketmq-all-4.4.0/distribution/target/apache-rocketmq/hs_err_pid8993.log這種原因是內(nèi)存不足導(dǎo)致的,默認是4G,解決辦法是編輯 bin/runserver.sh: JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn256m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
以守護進程的方式啟動:
nohup sh bin/mqnamesrv & 這個命令可能會nohup: ignoring input and appending output to ‘nohup.out’,如果出現(xiàn)這個,執(zhí)行:
tail -f nohup.out這個時候ctrl+c就不會退出程序,僅僅是讓程序后臺運行
啟動Broker
[root@wangzhi 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/software/rocketmq/distribution/target/apache-rocketmq/hs_err_pid3012.log出現(xiàn)了Broker內(nèi)存不足的問題:
vim bin/runbroker.sh 修改 JAVA_OPT="${JAVA_OPT} -server -Xms8g -Xmx8g -Xmn4g" 的內(nèi)容為:
JAVA_OPT="${JAVA_OPT} -server -Xms2g -Xmx2g -Xmn1g"完成之后以守護進程的方式進行啟動:
nohup sh bin/mqbroker -n localhost:9876 &
tail -f nohup.out這個時候可以使用jps查看進程,并且可以根據(jù)進程號來kill進程