mirror of
https://github.com/apache/rocketmq.git
synced 2026-08-28 20:09:14 +08:00
2.4 KiB
2.4 KiB
How to Debug RocketMQ in Idea
Step0: Resolve dependencies
- To download the Maven dependencies required for running RocketMQ, you can use the following command:
mvn clean install -Dmaven.test.skip=true - Ensure successful local compilation.
Step1: Start NameServer
- The startup class for NameServer is located in
org.apache.rocketmq.namesrv.NamesrvStartup. - Add environment variable
ROCKETMQ_HOME=<rocketmq repository directory>inIdea-Edit Configurations.
- Run NameServer and if the following log output is observed, it indicates successful startup.
The Name Server boot success. serializeType=JSON, address 0.0.0.0:9876
Step2: Start Broker
- The startup class for Broker is located in
org.apache.rocketmq.broker.BrokerStartup - Create the
/rocketmq/conf/broker.conffile or simply copy it from the official release package.
# broker.conf
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
namesrvAddr = 127.0.0.1:9876
- Add the runtime parameter
-c /Users/xxx/rocketmq/conf/broker.confand the environment variableROCKETMQ_HOME=<rocketmq repository directory>inIdea-Edit Configurations.
- Run the Broker and if the following log is observed, it indicates successful startup.
The broker[broker-a,192.168.1.2:10911] boot success...
Step3: Send or Consume Messages
RocketMQ startup is now complete. You can use the examples provided in /example to send and consume messages.
Additional: Start the Proxy locally.
- RocketMQ 5.x introduced the Proxy mode. Using the
LOCALmode eliminates the need forStep2. The startup class is located atorg.apache.rocketmq.proxy.ProxyStartup. - Add the environment variable
ROCKETMQ_HOME=<rocketmq repository directory>inIdea-Edit Configurations. - Create a new configuration file named
rmq-proxy.jsonin the/conf/directory.
{
"rocketMQClusterName": "DefaultCluster",
"nameSrvAddr": "127.0.0.1:9876",
"proxyMode": "local"
}
- Run the Proxy, and if the following log is observed, it indicates successful startup.
Sat Aug 26 15:29:33 CST 2023 rocketmq-proxy startup successfully