rocketmq installation record
problems encountered
- The startup error is reported as follows
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.
This is because of the BUG of the startup script, which misjudged the JDK version. Mine is version 1.8, so comment the following code to
bin/runserver.sh
file .
The modified content is as follows
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
}
Just comment out the judgment
- The machine with small memory cannot start, because the memory configuration in the startup configuration is too large, and the memory above 4g, just change it to a smaller size. Modify the
filebin/runserver.sh
Modify
JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx500m -Xmn500g -XX:MetaspaceSize=64m -XX:MaxMetaspaceSize=128m"
thebin/runbroker.sh
file
JAVA_OPT="${JAVA_OPT} -server -Xms128m -Xmx256m -Xmn256m"
start command
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 &