多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## 一、概述 从官网下载地址:[Downloading the Apache RocketMQ Releases - Apache RocketMQ](http://rocketmq.apache.org/dowloading/releases/)选择最新版本下载(不区分操作系统); > 目前目前支持最高的LTS版本为JDK1.8; ## 二、单机模式安装 解压,即可运行; ``` wget https://dlcdn.apache.org/rocketmq/4.9.1/rocketmq-all-4.9.1-source-release.zip unzip rocketmq-all-4.9.1-source-release.zip mv rocketmq-all-4.9.1-source-release rocketmq cd rocketmq ### maven执行安装 mvn -Prelease-all -DskipTests clean install -U ### distribution/target/rocketmq-4.9.1/rocketmq-4.9.1中,就是编译并安装好的应用根目录了 cd distribution/target/rocketmq-4.9.1/rocketmq-4.9.1 ``` ![](https://img.kancloud.cn/98/26/9826d17cf9526334669b02b96aef7013_1441x912.png) ## 三、运行测试 ### **启动Name Server** ``` nohup sh bin/mqnamesrv & ``` 查看日志: ``` tail -f ~/logs/rocketmqlogs/namesrv.log ``` ![](https://img.kancloud.cn/85/7b/857bc59f7b888b1c0216ec8c58b634e9_1104x223.png) 进程: ![](https://img.kancloud.cn/1b/48/1b48c756f66b47adfffeff1d220f689d_1419x220.png) ### **启动Broker** ``` nohup sh bin/mqbroker -n localhost:9876 & ``` 查看日志: ``` tail -f ~/logs/rocketmqlogs/broker.log ``` ![](https://img.kancloud.cn/5e/79/5e794cd88929268cdb058ca281fc1c78_1453x301.png) 进程: ![](https://img.kancloud.cn/5f/c0/5fc0e114fae5bbc214103d02741255d1_1420x419.png) >[danger] 注意,默认的,启动脚本中最小内存配置为8G了,如果实际物理内存不足,那么,需要修改该参数,否则,将无法正常启Broker; ### **关闭Broker** ``` sh bin/mqshutdown broker ``` ### **关闭Name Server** ``` sh bin/mqshutdown namesrv ``` ### **简单测试** **发送信息:** ``` export NAMESRV_ADDR=localhost:9876 sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer ``` ![](https://img.kancloud.cn/a0/35/a035f151fabf54199b1c091f1ee27794_1414x276.png) **接收消息:** ``` export NAMESRV_ADDR=localhost:9876 sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer ``` ![](https://img.kancloud.cn/04/90/0490da6717b83f0b4bbceaa10e672893_1431x420.png)