Skip to content

rocketMQ常见问题解决

一、内存不足

如果启动的时候报内存不足错误,修改bin目录下的配置文件runserver.sh 和runbroker.sh根据机器设置内存,生产环境尽量用默认设置 runserver.sh:JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn512m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m" runbroker.sh:JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn512m"

二、多网卡问题处理

报错提示: 1、Caused by: org.apache.rocketmq.remoting.exception.RemotingConnectException: connect to <172.17.42.1:10911> failed 2、com.alibaba.rocketmq.client.exception.MQClientException: Send [1] times, still failed, cost [1647]ms, Topic: TopicTest1, BrokersSent: [broker-a, null, null] 3、org.apache.rocketmq.client.exception.MQClientException: Send [3] times, still failed, cost [497]ms, Topic: TopicTest, BrokersSent: [chenyaowudeMacBook-Air.local, chenyaowudeMacBook-Air.local, chenyaowudeMacBook-Air.local] 解决方法: 1、设置producer: producer.setVipChannelEnabled(false); 2、编辑ROCKETMQ 配置文件:broker.conf(下列ip为自己的ip) namesrvAddr = 192.168.0.101:9876brokerIP1 = 192.168.0.101

三、磁盘空间不足

报错提示:DESC: service not available now, maybe disk full, CL: 修改启动脚本runbroker.sh,在里面增加一句话: JAVA_OPT="${JAVA_OPT} -Drocketmq.broker.diskSpaceWarningLevelRatio=0.98"(磁盘保护的百分比设置成98%, 只有磁盘空间使用率达到98%时才拒绝接收producer消息)

四、常见问题处理的路径

  1. https://blog.csdn.net/sqzhao/article/details/54834761

  2. https://blog.csdn.net/mayifan0/article/details/67633729

  3. https://blog.csdn.net/a906423355/article/details/78192828

五、自动创建topic

如果rocketMQ的配置autoCreateTopicEnable = true,默认是如果没有这个topic,自动创建,如果是false,则发送失败,需要手工去控制台创建topic。

六、队列queue

消费队列的queue一定要比consumer的数量多,否则多出来的consumer实例无法分到queue,即无法消费消息,起不到分摊的作用。所以需要控制数量。建议queue的数量是consumer的倍数。