rocketmq 实战过程会遇到这样或者那样的问题,今天我们专门抽出一篇文章来分析一下汇总一下,避免以后踩同样的坑:
1、找不到JDK的问题:
综合分析,是因为JDK安装的目录有空格导致的:Program Files 两个单词之间存在空格导致runserver.cmd、runbroker.cmd加载不到JDK :D:\Program Files\Java\jdk1.8.0_101
解决方案:可以重新安装JDK,目录中间不要存在空格;如果不方便重新安装JDK,可以修改runserver.cmd、runbroker.cmd两个配置文件,把空格避开;
修改:runserver.cmd
添加
set JAVAHOME="%JAVA_HOME%"
修改
set "JAVA_OPT=%JAVA_OPT% -Djava.ext.dirs=%BASE_DIR%lib;%JAVAHOME%\jre\lib\ext"
set "JAVA_OPT=%JAVA_OPT% -cp "%CLASSPATH%""
如同显示:
2、客户端springboot服务生产消息时报错:
MQBrokerException: CODE: 14 DESC: service not available now. It may be caused by one of the following reasons: the broker's disk is full [CL: 0.93 CQ: 0.93 INDEX: 0.93], messages are put to the slave, message store has been shut down, etc. BROKER: 192.118.10.111:10911
核心点:the broker's disk is full,证明broker 内存已经满了,因为其默认情况达到85%内存就报此错误,可以修改为99%,意思是内存达到99%,才报此错;也可以修改broker的内存大小,默认2G
修改内存占用阈值:runbroker.cmd 里添加
set "JAVA_OPT=%JAVA_OPT% -Drocketmq.broker.diskSpaceWarningLevelRatio=0.99"
修改默认内存大小,最初修改512m,可以改成1024:
set "JAVA_OPT=%JAVA_OPT% -server -Xms1024m -Xmx1024m"
如同显示:
3、
4、
5、