• 首页
  • 产品中心
    • 数式Oinone四大产品

      低代码开发平台无代码开发平台集成开发平台AI大模型开发
    • 数式Oinone体系能力

      用户与组织权限管理文件管理消息中心国际化业务审计
    • 数式Oinone核心产品特性

      低无一体面向软件公司场景无限制应用级扩容可分可合
  • 服务中心
    • 客户服务

      预约演示方案咨询私有部署找人定制
    • 开发者

      问答下载
    • Oinone学院

      社区学习

    《精讲面向软件公司的低代码平台——以Oinone为例》

  • 合作伙伴
    渠道申请伙伴名录专家库
  • 关于数式
0571-88757863

RocketMQ Setup


Ⅰ. Download the Installation Package

Download: https://rocketmq.apache.org/download

It is recommended to use versions 4.5.2 and above, and below 5.0.0. Version 4.5.2 is recommended for installation.

Note

The following commands must be executed from the RocketMQ installation directory. You can access this directory by running the command cd <RocketMQ installation directory>. On Linux/macOS, use the default terminal; on Windows, use PowerShell (unless CMD is specified).

II. Installation

(Ⅰ) Decompression

Visualize or decompress using the following command

# Linux/macOS
unzip rocketmq-all-4.5.2-bin-release.zip -d <RocketMQ installation directory>
# Windows
Expand-Archive .\rocketmq-all-4.5.2-bin-release.zip <RocketMQ installation directory>

Tips

For convenience, you can create symbolic links to the RocketMQ installation directory.

Create symbolic link (optional)

# Linux/macOS
ln -s rocketmq-all-4.5.2-bin-release rocketmq
# Windows
New-Item -Path .\rocketmq\ -ItemType SymbolicLink -Target .\rocketmq-all-4.5.2-bin-release

Note

On Windows systems, using PowerShell to create symbolic links may require PowerShell to be running with administrator privileges or developer mode to be turned on.

(Ⅱ) Modify Configuration for the Development Environment

Note

The default JVM runtime memory settings of RocketMQ are too large for the local development environment. It is recommended to adjust the memory values to optimize performance.

Modify NameServer Running Memory

# Linux/macOS
awk '
{
    gsub(/-Xms4g -Xmx4g -Xmn2g/, "-Xms1g -Xmx1g -Xmn1g")
    if ($0 ~ /choose_gc_log_directory/) {
        count++
        if (count == 2) {
            print "#choose_gc_log_directory"
            next
        }
    }
    print
}
' ./bin/runserver.sh > ./bin/tmp && mv ./bin/tmp ./bin/runserver.sh
# Windows
(Get-Content .\bin\runserver.cmd) | ForEach-Object { $_ -replace '-Xms2g -Xmx2g -Xmn1g', '-Xms1g -Xmx1g -Xmn1g' } | Set-Content .\bin\runserver.cmd

Modify Broker Run Memory

# Linux/macOS
awk '
{
    gsub(/-Xms8g -Xmx8g -Xmn4g/, "-Xms1g -Xmx1g -Xmn1g")

    if ($0 ~ /choose_gc_log_directory/) {
        count++
        if (count == 2) {
            print "#choose_gc_log_directory"
            next
        }
    }

    print
}
' ./bin/runbroker.sh > ./bin/tmp && mv ./bin/tmp bin/runbroker.sh
# Windows
(Get-Content .\bin\runbroker.cmd) | ForEach-Object { $_ -replace '-Xms2g -Xmx2g -Xmn1g', '-Xms1g -Xmx1g -Xmn1g' } | Set-Content .\bin\runbroker.cmd

Modify Broker Configuration

# Linux/macOS
cat > ./conf/broker.conf << EOF
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
namesrvAddr = 127.0.0.1:9876
brokerIP1 = 127.0.0.1
EOF
# Windows
Set-Content -Path .\conf\broker.conf -Value @(
    "brokerClusterName = DefaultCluster"
    "brokerName = broker-a"
    "brokerId = 0"
    "deleteWhen = 04"
    "fileReservedTime = 48"
    "brokerRole = ASYNC_MASTER"
    "flushDiskType = ASYNC_FLUSH"
    "namesrvAddr = 127.0.0.1:9876"
    "brokerIP1 = 127.0.0.1"
)

III. Operation

Linux/macOS

# NameServer
nohup ./bin/mqnamesrv start >> ./namesrv.nohup 2>&1 &
# Broker
nohup ./bin/mqbroker -c ./conf/broker.conf >> ./broker.nohup 2>&1 &

Windows

# NameServer
$env:ROCKETMQ_HOME = <RocketMQ installation directory>
Start-Process -FilePath ".\bin\mqnamesrv.cmd" -ArgumentList "start" -WindowStyle Hidden
# Broker
$env:ROCKETMQ_HOME = <RocketMQ installation directory>
Start-Process -FilePath ".\bin\mqbroker.cmd" -ArgumentList "-c .\conf\broker.conf" -WindowStyle Hidden

IV. Verification

Type jps -l in the command line

59205 org.apache.rocketmq.namesrv.NamesrvStartup
59306 org.apache.rocketmq.broker.BrokerStartup

The command line should output similar information.

V. Stop

# Linux/macOS
./bin/mqshutdown broker
./bin/mqshutdown namesrv
# Windows
.\bin\mqshutdown.cmd broker
.\bin\mqshutdown.cmd namesrv

Note

On Windows, run RocketMQ commands in CMD.

Edit this page
Last Updated:1/15/26, 4:02 AM
Prev
Git Setup
Next
Zookeeper Setup
默认页脚
Copyright © 2026 Mr.Hope