This is an automated email from the ASF dual-hosted git repository.

kaili pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new 0f01df460f [ISSUE 7265] Doc: Adding how to debug in Idea document 
(#7266)
0f01df460f is described below

commit 0f01df460f78c383a35338aa77eb0fda4c8f2dd3
Author: Ao Qiao <qiao...@foxmail.com>
AuthorDate: Mon Oct 16 11:37:25 2023 +0800

    [ISSUE 7265] Doc: Adding how to debug in Idea document (#7266)
---
 docs/cn/Debug_In_Idea.md                 |  55 +++++++++++++++++++++++++++++++
 docs/cn/image/Idea_config_broker.png     | Bin 0 -> 215173 bytes
 docs/cn/image/Idea_config_nameserver.png | Bin 0 -> 204631 bytes
 docs/en/Debug_In_Idea.md                 |  55 +++++++++++++++++++++++++++++++
 4 files changed, 110 insertions(+)

diff --git a/docs/cn/Debug_In_Idea.md b/docs/cn/Debug_In_Idea.md
new file mode 100644
index 0000000000..fd01751ee9
--- /dev/null
+++ b/docs/cn/Debug_In_Idea.md
@@ -0,0 +1,55 @@
+## 本地调试RocketMQ
+
+### Step0: 解决依赖问题
+1. 运行前下载RocketMQ需要的maven依赖,可以使用`mvn clean install -Dmaven.test.skip=true`
+2. 确保本地能够编译通过
+
+### Step1: 启动NameServer
+1. NamerServer的启动类在`org.apache.rocketmq.namesrv.NamesrvStartup`
+2. `Idea-Edit Configurations`中添加运行参数 `ROCKETMQ_HOME=<rocketmq仓库目录>`
+![Idea_config_nameserver.png](image/Idea_config_nameserver.png)
+3. 运行NameServer,观察到如下日志输出则启动成功
+```shell
+The Name Server boot success. serializeType=JSON, address 0.0.0.0:9876
+```
+
+### Step2: 启动Broker
+1. Broker的启动类在`org.apache.rocketmq.broker.BrokerStartup`
+2. 创建`/rocketmq/conf/broker.conf`文件或直接在官方release发布包中拷贝即可
+```shell
+# 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 # name server地址
+```
+3. `Idea-Edit Configurations`中添加运行参数 `ROCKETMQ_HOME=<rocketmq仓库目录>` 以及环境变量`-c 
/Users/xxx/rocketmq/conf/broker.conf`
+![Idea_config_broker.png](image/Idea_config_broker.png)
+4. 运行Broker,观察到如下日志则启动成功
+```shell
+The broker[broker-a,192.169.1.2:10911] boot success...
+```
+
+### Step3: 发送或消费消息
+至此已经完成了RocketMQ的启动,可以使用`/example`里的示例进行收发消息
+
+### 补充:本地启动Proxy
+1. 
RocketMQ5.x支持了Proxy模式,使用`LOCAL`模式可以免去`Step2`,启动类在`org.apache.rocketmq.proxy.ProxyStartup`
+2. `Idea-Edit Configurations`中添加运行参数 `ROCKETMQ_HOME=<rocketmq仓库目录>`
+3. 在`/conf/`下新建配置文件`rmq-proxy.json`
+```json
+{
+  "rocketMQClusterName": "DefaultCluster",
+  "nameSrvAddr": "127.0.0.1:9876",
+  "proxyMode": "local"
+}
+```
+4. 运行Proxy,观察到如下日志则启动成功
+```shell
+Sat Aug 26 15:29:33 CST 2023 rocketmq-proxy startup successfully
+```
\ No newline at end of file
diff --git a/docs/cn/image/Idea_config_broker.png 
b/docs/cn/image/Idea_config_broker.png
new file mode 100644
index 0000000000..6fbedcfb62
Binary files /dev/null and b/docs/cn/image/Idea_config_broker.png differ
diff --git a/docs/cn/image/Idea_config_nameserver.png 
b/docs/cn/image/Idea_config_nameserver.png
new file mode 100644
index 0000000000..65edd99113
Binary files /dev/null and b/docs/cn/image/Idea_config_nameserver.png differ
diff --git a/docs/en/Debug_In_Idea.md b/docs/en/Debug_In_Idea.md
new file mode 100644
index 0000000000..9967980671
--- /dev/null
+++ b/docs/en/Debug_In_Idea.md
@@ -0,0 +1,55 @@
+## How to Debug RocketMQ in Idea
+
+### Step0: Resolve dependencies
+1. To download the Maven dependencies required for running RocketMQ, you can 
use the following command:`mvn clean install -Dmaven.test.skip=true`
+2. Ensure successful local compilation.
+
+### Step1: Start NameServer
+1. The startup class for NameServer is located in 
`org.apache.rocketmq.namesrv.NamesrvStartup`.
+2. Add runtime `ROCKETMQ_HOME=<rocketmq repository directory>` parameters in 
`Idea-Edit Configurations`.
+![Idea_config_nameserver.png](../cn/image/Idea_config_nameserver.png)
+3. Run NameServer and if the following log output is observed, it indicates 
successful startup.
+```shell
+The Name Server boot success. serializeType=JSON, address 0.0.0.0:9876
+```
+
+### Step2: Start Broker
+1. The startup class for Broker is located 
in`org.apache.rocketmq.broker.BrokerStartup`
+2. Create the `/rocketmq/conf/broker.conf` file or simply copy it from the 
official release package.
+```shell
+# 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 # name server地址
+```
+3. Add the runtime parameter `ROCKETMQ_HOME=<rocketmq repository directory>` 
and the environment variable `-c /Users/xxx/rocketmq/conf/broker.conf` in 
`Idea-Edit Configurations`.
+![Idea_config_broker.png](../cn/image/Idea_config_broker.png)
+4. Run the Broker and if the following log is observed, it indicates 
successful startup.
+```shell
+The broker[broker-a,192.169.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.
+1. RocketMQ 5.x introduced the Proxy mode. Using the `LOCAL` mode eliminates 
the need for `Step2`. The startup class is located at 
`org.apache.rocketmq.proxy.ProxyStartup`.
+2. Add the runtime parameter `ROCKETMQ_HOME=<rocketmq repository directory>` 
in `Idea-Edit Configurations`.
+3. Create a new configuration file named `rmq-proxy.json` in the `/conf/` 
directory.
+```json
+{
+  "rocketMQClusterName": "DefaultCluster",
+  "nameSrvAddr": "127.0.0.1:9876",
+  "proxyMode": "local"
+}
+```
+4. Run the Proxy, and if the following log is observed, it indicates 
successful startup.
+```shell
+Sat Aug 26 15:29:33 CST 2023 rocketmq-proxy startup successfully
+```
\ No newline at end of file

Reply via email to