1.下载RocketMq
Read and Comment - Apache RocketMQ
2.下载控制台界面包
GitHub - apache/rocketmq-externals at develop
3.配置环境变量
变量名:ROCKETMQ_HOME
变量值:解压位置
4.?下载的mq的conf目录下的broker.conf文件修改
打开过滤器支持:enablePropertyFilter=true
服务地址:namesrvAddr=(本机)127.0.0.1:9876
?
?5.在bin路径下打开cmd小黑板输入以下命令启动服务
start mqnamesrv.cmd
start mqbroker.cmd -n 127.0.0.1:9876 autoCreateTopicEnable=true
?
?都执行后会弹出两个窗口并输出以下数据为启动成功
?6.如何打开web控制台
新建一个文件夹,我这里就叫“RocketMQ-console”
7.在文件夹中添加一个配置文件
配置文件名称:application.properties
在配置文件中添加控制台要绑定的mq服务的地址
由前面启动的mq服务来看前面启动的mq服务地址是127.0.0.1:9876所以添加为下面的
连接地址:rocketmq.config.namesrvAddr=127.0.0.1:9876
设置启动服务端口:server.port=10086(随意)
?8.在文件夹中添加一个打包文件(为前面下载的控制台界面包的打包)
在下载的rocketmq-externals控制台界面包中找到rocketmq-console文件,在该文件下打开cmd输入打包命令就会生成target这个文件夹,打包好的数据就在该文件夹下
mvn package
?
?然后找到打包出来的文件rocketmq-console-ng-1.0.0.jar,将他拷贝到新建的“RocketMQ-console”文件夹下
9.启动mq控制台代码
在新建文件夹下打开cmd输入以下命令启动
java -jar rocketmq-console-ng-1.0.1.jar
?在浏览器打开控制台:http://127.0.0.1:10086(你配的端口)
10.可能出现的问题
(1):出现一些连接出错问题,可能是rocketmq-console/src/main/resources未配置导致的
打包前要将这个配置写上rocketmq.config.namesrvAddr=127.0.0.1:9876
?
org.apache.rocketmq.remoting.exception.RemotingConnectException: connect to 127.0.0.1:9876 failed
at org.apache.rocketmq.remoting.netty.NettyRemotingClient.invokeSync(NettyRemotingClient.java:392) ~[classes/:na]
at org.apache.rocketmq.broker.out.BrokerOuterAPI.registerBroker(BrokerOuterAPI.java:201) ~[classes/:na]
at org.apache.rocketmq.broker.out.BrokerOuterAPI.access$000(BrokerOuterAPI.java:61) ~[classes/:na]
at org.apache.rocketmq.broker.out.BrokerOuterAPI$1.run(BrokerOuterAPI.java:154) ~[classes/:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_131]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_131]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]
?(2):打包时出现版本问题
[ERROR] Failed to execute goal on project rocketmq-console-ng: Could not resolve dependencies for project org.apache:rocketmq-console-ng:jar:1.0.0: The following artifacts could not be resolved: org.apache.rocketmq:rocketmq-tools:jar:4.4.0-SNAPSHOT, org.apache.rocketmq:rocketmq-namesrv:jar:4.4.0-SNA
PSHOT, org.apache.rocketmq:rocketmq-broker:jar:4.4.0-SNAPSHOT: Failure to find org.apache.rocketmq:rocketmq-tools:jar:4.4.0-SNAPSHOT in http://maven.aliyun.com/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of alimaven ha
s elapsed or updates are forced -> [Help 1]
将pom.xml文件下的rocketmq版本4.4.0-SNAPSHOT改成4.4.0
?(3):打包出现以下问题
Task org.apache.rocketmq.broker.out.BrokerOuterAPI$1@3b0b9e11 rejected from org.apache.rocketmq.broker.latency.BrokerFixedThreadPoolExecutor@56b9e08d[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 1]
at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2063)
at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1379)
at org.apache.rocketmq.broker.out.BrokerOuterAPI.registerBrokerAll(BrokerOuterAPI.java:146)
at org.apache.rocketmq.broker.BrokerController.doRegisterBrokerAll(BrokerController.java:932)
at org.apache.rocketmq.broker.BrokerController.registerBrokerAll(BrokerController.java:926)
at org.apache.rocketmq.broker.topic.TopicConfigManager.createTopicInSendMessageBackMethod(TopicConfigManager.java:267)
at org.apache.rocketmq.broker.transaction.queue.TransactionalMessageBridge.selectTopicConfig(TransactionalMessageBridge.java:286)
at org.apache.rocketmq.broker.transaction.queue.TransactionalMessageBridge.fetchMessageQueues(TransactionalMessageBridge.java:85)
at org.apache.rocketmq.broker.transaction.queue.TransactionalMessageServiceImpl.check(TransactionalMessageServiceImpl.java:125)
at org.apache.rocketmq.broker.transaction.TransactionalMessageCheckService.onWaitEnd(TransactionalMessageCheckService.java:76)
at org.apache.rocketmq.common.ServiceThread.waitForRunning(ServiceThread.java:121)
at org.apache.rocketmq.broker.transaction.TransactionalMessageCheckService.run(TransactionalMessageCheckService.java:65)
at java.lang.Thread.run(Thread.java:748)
[2022-04-06 17:39:23.190] ERROR Check error
需要在pom.xml文件下添加下面的配置
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
|