RocketMQ的坑(一)--搭好环境跑起来

RocketMQ的坑(一)–搭好环境跑起来

主要问题:

  • VM内存不足
  • 找不到主类
  • linux下找不到java环境变量

VM内存不足

  • 问题:
    Error occurred during initialization of VM
    Could not reserve enough space for 2097152KB object heap
  • 解决办法:
    修改bin下的runserver脚本,把set “JAVA_OPT=%JAVA_OPT% -server -Xms500m -Xmx500m -Xmn500m -XX:PermSize=128m -XX:MaxPermSize=320m”的Xms、Xmx、Xmn改小点。相关知识见jvm。
  • 解决后:
    RocketMQ的坑(一)--搭好环境跑起来_第1张图片

找不到主类

  • 解决办法
    更新maven版本 ,官方要求3.2.x,而我的mavne是3.1.1

linux下找不到java环境变量

  • 问题描述
ERROR: Please set the JAVA_HOME variable in your environment, We need java(x64)! !!
  • 解决办法:modify runserver.sh
vim runserver.sh
error_exit ()
{
    echo "ERROR: $1 !!"
    exit 1
}
JAVA_HOME=/home/orca/java/jdk1.8.0_144
#[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java
#[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java
#[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)!"
$sudo export JAVA_HOME
$sudo export JAVA="$JAVA_HOME/bin/java"
$sudo export BASE_DIR=$(dirname $0)/..
$sudo export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH}

#===========================================================================================
# JVM Configuration
#===========================================================================================
JAVA_OPT="${JAVA_OPT} -server -Xms4g -Xmx4g -Xmn2g -XX:PermSize=128m -XX:MaxPermSize=320m"
JAVA_OPT="${JAVA_OPT} -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:+DisableExplicitGC -XX:-UseParNewGC"
JAVA_OPT="${JAVA_OPT} -verbose:gc -Xloggc:/dev/shm/rmq_srv_gc.log -XX:+PrintGCDetails"
JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow"
JAVA_OPT="${JAVA_OPT}  -XX:-UseLargePages"
JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${BASE_DIR}/lib"
#JAVA_OPT="${JAVA_OPT} -Xdebug -Xrunjdwp:transport=dt_socket,address=9555,server=y,suspend=n"
JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}"
JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}"

$sudo java ${JAVA_OPT} $@

这里写图片描述

你可能感兴趣的:(rocketmq)