rocketmq-console 部署采坑记录
Github:https://github.com/apache/rocketmq-externals.git
配置
进入rocketmq-externals\rocketmq-console\src\main\resources
文件夹,打开application.properties
进行配置
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中定义
编译
cd rocketmq-externals\rocketmq-console
mvn clean package -Dmaven.test.skip=true
升级依赖
升级 Spring Boot、Java、RocketMQ、Aspectj 版本
<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
错误信息:
org.aspectj.apache.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 18
解决方案:
<!-- 旧版本,不支持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
错误信息:
Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17
解决方案:
<!-- <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
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
@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
添加未实现的方法
@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)日志
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
注解
@EnableScheduling
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}
版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/03/24/rocketmq-console-deployment/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。
共有 0 条评论