- 64位操作系统,生产环境建议Linux/Unix/MacOS(Windows操作系统安装说明详见 Windows操作系统安装教程)
- 64位JDK 1.8+
- 4G+的可用磁盘
unzip rocketmq-all-4.5.1-bin-release.zip
cd rocketmq-all-4.5.1-bin-release
nohup sh bin/mqnamesrv &
tail -f ~/logs/rocketmqlogs/namesrv.log
2019-07-18 17:03:56 INFO main - The Name Server boot success. …
nohup sh bin/mqbroker -n localhost:9876 &
tail -f ~/logs/rocketmqlogs/broker.log
2019-07-18 17:08:41 INFO main - The broker[itmuchcomdeMacBook-Pro.local, 192.168.43.197:10911] b
export NAMESRV_ADDR=localhost:9876
sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer
复制代码
SendResult [sendStatus=SEND_OK, msgId=C0A82BC5F36C511D50C05B41…
执行如下命令:
sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer
复制代码
能看到类似如下输出:
ConsumeMessageThread_4 Receive New Messages: [MessageExt [queueId=3, stor....
复制代码
依次执行以下两条命令即可
sh bin/mqshutdown broker
复制代码
The mqbroker(36695) is running...
Send shutdown request to mqbroker(36695) OK
复制代码
sh bin/mqshutdown namesrv
复制代码
The mqnamesrv(36664) is running...
Send shutdown request to mqnamesrv(36664) OK
复制代码
找到rocketmq-console/src/main/resources/application.properties 根据需求,修改配置
- server.contextPath
- 管理后台访问上下文路径,默认为空
- 如果填写,需写成/xxx的形式,例如/console
- 控制台的端口
- server.port=8080
- Name Server地址(if this value is empty,use env value rocketmq.config.namesrvAddr NAMESRV_ADDR | now, you can set it in ops page.default localhost:9876)
- rocketmq.config.namesrvAddr=
- rocketmq.config.isVIPChannel=( if you use rocketmq version < 3.5.8, rocketmq.config.isVIPChannel should be false.default true)
- rocketmq-console’s data path:dashboard/monitor
- rocketmq.config.dataPath=/tmp/rocketmq-console/data
- rocketmq.config.enableDashBoardCollect=true
- rocketmq.config.msgTrackTopicName=(set the message track trace topic if you don’t want use the default one)
- rocketmq.config.ticketKey=ticket
rocketmq.config.loginRequired=false(#Must create userInfo file: ${rocketmq.config.dataPath}/users.properties if the login is required)
server.port=17890
也可以不修改,在启动完console后,在控制台导航栏 - 运维 - NameSvrAddrList一栏设置
rocketmq.config.namesrvAddr=localhost:9876
修改 pom.xml ,修改RocketMQ相关依赖的版本
<rocketmq.version>4.4.0rocketmq.version>
修改为
<rocketmq.version>你的RocketMQ版本rocketmq.version>
复制代码
例如:
<rocketmq.version>4.5.1rocketmq.version>
复制代码
修改pom.xml后,org.apache.rocketmq.console.service.impl.MessageServiceImpl#queryMessageByTopic 编译会报错,所以需要解决一下。
DefaultMQPullConsumer consumer = new DefaultMQPullConsumer(MixAll.TOOLS_CONSUMER_GROUP, null)
改为:RPCHook rpcHook = null
DefaultMQPullConsumer consumer = new DefaultMQPullConsumer(MixAll.TOOLS_CONSUMER_GROUP, rpcHook)
复制代码
切换到代码根目录
cd rocketmq-externals
复制代码
cd rocketmq-console
复制代码
mvn clean package -DskipTests
复制代码
java -jar rocketmq-console-ng-1.0.1.jar
复制代码
访问 http://localhost:17890 (端口用上面 application.properties 中的 server.port=17890 指定,默认是8080) ,即可看到界面
分享资源
获取以上资源请访问开源项目 点击跳转