In window environment with JDK 1.8, I donwload Apache RocketMQ 5.1.4 binary source and start the namesrv and broker with command "start mqnamesrv.cmd" and "start mqbroker.cmd -n localhost:9876 autoCreateTopicEnable=true" respectively. Both shows boot success. However, when I use a Main.java to send the message to name server. The index file is keep adding 400MB file per second. Like this: enter image description here
Also, I have tried to config the "broker.conf" on changing fileReservedTime from 120 to 0.04. I want to avoid the full of disk but it fails. Also, I add "autoTopicEnable=true" in broker.conf is fail too. Is my Main.java casue this error? My purpose is to avoid the full of disk and let the nameserver and broker keep running.
Main.java's Source Code:
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.remoting.common.RemotingHelper;
// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`,
// then press Enter. You can now see whitespace characters in your code.
public class Main {
public static void main(String[] args) throws Exception {
// 初始化一个producer并设置Producer group name
DefaultMQProducer producer = new DefaultMQProducer("Info"); //(1)
// 设置NameServer地址
producer.setNamesrvAddr("localhost:9876"); //(2)
// Set the messege resend times to 2
producer.setRetryTimesWhenSendFailed(2);
// Set messge timeout second to 3000ms
producer.setSendMsgTimeout(3000);
// 启动producer
producer.start();
for (int i = 0; i < 2; i++) {
// 创建一条消息,并指定topic、tag、body等信息,tag可以理解成标签,对消息进行再归类,RocketMQ可以在消费端对tag进行过滤
Message msg = new Message("Topic" +
"DeveloperTeam" /* Tag */,
("CheckMsg" + i).getBytes(RemotingHelper.DEFAULT_CHARSET) /* Message body */
); //(3)
// 利用producer进行发送,并同步等待发送结果
SendResult sendResult = producer.send(msg); //(4)
System.out.printf("%s%n", sendResult);
}
// 一旦producer不再使用,关闭producer
producer.shutdown();
}
}
I have tried to config "broker.conf" and run the command "start mqbroker.cmd -n localhost:9876 messageIndexEnable=false fileReservedTime=0.004".