Unrecognized option: -Xlog:gc*:file=/dev/shm/rmq_srv_gc_%p_%t.log:time,tags:filecount=5,filesize=30M Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
这个是因为启动脚本的BUG,误判了JDK版本,我的是1.8版本,所以注释以下代码即可
bin/runserver.sh
文件
修改内容如下
choose_gc_options() { # Example of JAVA_MAJOR_VERSION value : '1', '9', '10', '11', ... # '1' means releases befor Java 9 JAVA_MAJOR_VERSION=$("$JAVA" -version 2>&1 | sed -E -n 's/.* version "([0-9]*).*$/\1/p') # if [[ "$JAVA_MAJOR_VERSION" -lt "9" ]] ; then JAVA_OPT="${JAVA_OPT} -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:-UseParNewGC" JAVA_OPT="${JAVA_OPT} -verbose:gc -Xloggc:${GC_LOG_DIR}/rmq_srv_gc_%p_%t.log -XX:+PrintGCDetails" JAVA_OPT="${JAVA_OPT} -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m" # else # JAVA_OPT="${JAVA_OPT} -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0" # JAVA_OPT="${JAVA_OPT} -Xlog:gc*:file=${GC_LOG_DIR}/rmq_srv_gc_%p_%t.log:time,tags:filecount=5,filesize=30M" # fi }
注释掉判断即可
bin/runserver.sh
文件JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx500m -Xmn500g -XX:MetaspaceSize=64m -XX:MaxMetaspaceSize=128m"
bin/runbroker.sh
文件JAVA_OPT="${JAVA_OPT} -server -Xms128m -Xmx256m -Xmn256m"
cd /home/virde/program/rocketmq-all-4.8.0-bin-release -- 启动namesrv nohup sh ./bin/mqnamesrv >> ./logs/namesrv.log & -- 启动broker nohup sh bin/mqbroker -n localhost:9876 >> ./logs/mqbroker.log &