rocketmq-console 部署采坑记录

Github:https://github.com/apache/rocketmq-externals.git

配置

进入rocketmq-externals\rocketmq-console\src\main\resources文件夹,打开application.properties进行配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
server.contextPath=
server.port=8088 //配置插件工程端口

### SSL setting
#server.ssl.key-store=classpath:rmqcngkeystore.jks
#server.ssl.key-store-password=rocketmq
#server.ssl.keyStoreType=PKCS12
#server.ssl.keyAlias=rmqcngkey

#spring.application.index=true
spring.application.name=rocketmq-console
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
spring.http.encoding.force=true
spring.main.allow-bean-definition-overriding=true
logging.config=classpath:logback.xml
#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=192.168.0.1:9876 //配置MQ地址(默认端口为9876)
#if you use rocketmq version < 3.5.8, rocketmq.config.isVIPChannel should be false.default true
rocketmq.config.isVIPChannel=
#rocketmq-console's data path:dashboard/monitor
rocketmq.config.dataPath=/tmp/rocketmq-console/data
#set it false if you don't want use dashboard.default true
rocketmq.config.enableDashBoardCollect=true
#set the message track trace topic if you don't want use the default one
rocketmq.config.msgTrackTopicName=
rocketmq.config.ticketKey=ticket

#Must create userInfo file: ${rocketmq.config.dataPath}/users.properties if the login is required
rocketmq.config.loginRequired=false //配置是否启用用户登录,用户名及密码、用户角色在users.properties中定义

编译

1
2
cd rocketmq-externals\rocketmq-console
mvn clean package -Dmaven.test.skip=true

升级依赖

升级 Spring Boot、Java、RocketMQ、Aspectj 版本

1
2
3
4
5
6
7
8
9
10
11
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1.RELEASE</version>
</parent>

<properties>
<java.version>1.8</java.version>
<rocketmq.version>4.5.2</rocketmq.version>
<aspectj.version>1.8.9</aspectj.version>
</properties>

升级aspectj

错误信息:

1
org.aspectj.apache.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 18

解决方案:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!-- 旧版本,不支持JDK1.7以上的新特性 -->
<!-- <dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.6.11</version>
</dependency> -->

<!-- 该版本完美解决 -->
<!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.9</version>
</dependency>

参考:解决在JDK8中org.aspectj.apache.bcel.classfile.ClassFormatException

禁用maven-checkstyle-plugin

错误信息:

1
Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17

解决方案:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!--            <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-checkstyle-plugin</artifactId>-->
<!-- <version>2.17</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>validate</id>-->
<!-- <phase>validate</phase>-->
<!-- <configuration>-->
<!-- <excludes>src/main/resources</excludes>-->
<!-- <configLocation>style/rmq_checkstyle.xml</configLocation>-->
<!-- <encoding>UTF-8</encoding>-->
<!-- <consoleOutput>true</consoleOutput>-->
<!-- <failsOnError>true</failsOnError>-->
<!-- </configuration>-->
<!-- <goals>-->
<!-- <goal>check</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->

参考:RocketMQ Console安装时报Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17错误

源码改动

(1)org/apache/rocketmq/console/config/RMQConfigure.java

1
2
3
4
5
6
import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.ErrorPageRegistrar;
import org.springframework.boot.web.server.ErrorPageRegistry;
//import org.springframework.boot.web.servlet.ErrorPage;
//import org.springframework.boot.web.servlet.ErrorPageRegistrar;
//import org.springframework.boot.web.servlet.ErrorPageRegistry;

(2)org/apache/rocketmq/console/service/impl/MessageServiceImpl.java

1
2
3
4
5
@Override
public List<MessageView> queryMessageByTopic(String topic, final long begin, final long end) {
//DefaultMQPullConsumer consumer = new DefaultMQPullConsumer(MixAll.TOOLS_CONSUMER_GROUP, null);
DefaultMQPullConsumer consumer = new DefaultMQPullConsumer(MixAll.TOOLS_CONSUMER_GROUP);
List<MessageView> messageViewList = Lists.newArrayList();

(3)org/apache/rocketmq/console/service/client/MQAdminExtImpl.java

添加未实现的方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
@Service
public class MQAdminExtImpl implements MQAdminExt {

@Override
public void createAndUpdatePlainAccessConfig(String s, PlainAccessConfig plainAccessConfig) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {

}

@Override
public void deletePlainAccessConfig(String s, String s1) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {

}

@Override
public void updateGlobalWhiteAddrConfig(String s, String s1) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {

}

@Override
public ClusterAclVersionInfo examineBrokerClusterAclVersionInfo(String s) throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
return null;
}

@Override
public boolean resumeCheckHalfMessage(String s) throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
return false;
}

@Override
public boolean resumeCheckHalfMessage(String s, String s1) throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
return false;
}
}

使用控制台仪表盘时报错 This date have’t data!

现象

(1)控制台

控制台Dashboard仪表盘获取数据错误,不停的报错This date have't data!

(2)日志

1
2
3
4
5
rmqconsole | [2019-11-14 12:28:56.808] ERROR op=global_exception_handler_print_error
rmqconsole | org.apache.rocketmq.console.exception.ServiceException: This date have't data!
rmqconsole | at org.apache.rocketmq.console.service.impl.DashboardCollectServiceImpl.getTopicCache(DashboardCollectServiceImpl.java:150)
rmqconsole | at org.apache.rocketmq.console.service.impl.DashboardServiceImpl.queryTopicData(DashboardServiceImpl.java:46)
rmqconsole | at org.apache.rocketmq.console.controller.DashboardController.topic(DashboardController.java:47)

(3)/tmp/rocketmq-console/data目录未生成数据

/tmp/rocketmq-console/data目录未生成dashboardyyyy-MM-dd.json格式的数据文件

解决

org/apache/rocketmq/console/task/DashboardCollectTask.java开启Scheduled定时任务,故需要在启动类中添加@EnableScheduling注解

1
2
3
4
5
6
@EnableScheduling
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}

Powered by AppBlog.CN     浙ICP备14037229号

Copyright © 2012 - 2020 APP开发技术博客 All Rights Reserved.

访客数 : | 访问量 :