- 源码地址: rocketmq-dashboard
- 官方文档: RocketMQ Dashboard
RocketMQ Dashboard 是 RocketMQ 的管控利器,为用户提供客户端和应用程序的各种事件、性能的统计信息,支持以可视化工具代替 Topic 配置、Broker 管理等命令行操作。
部署环境
- CPU 架构: loongarch64
- 系统版本: Kylin Linux Advanced Server V10 (Tercel)
- rocketmq Dashboard 版本: 1.0.0
准备环境
部署 JDK
下载 jdk
1
wget http://ftp.loongnix.cn/Java/openjdk8/loongson8.1.11-jdk8u332b09-linux-loongarch64.tar.gz
安装 jdk
1
2
3
4
5
6
7
8
9
10
11
12
13
14# 创建 jdk 安装目录
mkdir -p /usr/local/java
# 解压 jdk 到安装目录
tar xf loongson8.1.11-jdk8u332b09-linux-loongarch64.tar.gz -C /usr/local/java/
# 配置环境变量
cat > /etc/profile.d/java.sh <<EOF
#!/bin/bash
export JAVA_HOME=/usr/local/java/jdk1.8.0_332
export CLASSPATH=\$CLASSPATH:\$JAVA_HOME/lib:\$JAVA_HOME/jre/lib
export PATH=\$JAVA_HOME/bin:\$JAVA_HOME/jre/bin:\$PATH:$HOME/bin
EOF检查 jdk 版本
1
2
3
4
5source /etc/profile.d/java.sh
# java -version
openjdk version "1.8.0_332"
OpenJDK Runtime Environment (Loongson 8.1.11-loongarch64-LoongnixServer) (build 1.8.0_332-b09)
OpenJDK 64-Bit Server VM (build 25.332-b09, mixed mode)
部署 Maven
下载 maven 安装包
1
wget https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
安装 maven
1
2
3
4
5
6
7
8
9
10
11
12
13# 创建 maven 安装目录
mkdir /usr/local/maven
# 解压 maven 到安装目录
tar xf apache-maven-3.8.6-bin.tar.gz -C /usr/local/maven/
# 配置环境变量
cat > /etc/profile.d/maven.sh <<EOF
#!/bin/bash
export MAVEN_HOME=/usr/local/maven/apache-maven-3.8.6
export PATH=\$MAVEN_HOME/bin:\$PATH:\$HOME/bin
EOF修改 conf/settings.xml 配置文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24# 修改配置文件,在 mirrors 配置里面添加阿里云 maven 仓库
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
# 修改资源保存位置。在 localRepository 下面加入配置
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
<localRepository>/data/maven/repo</localRepository>
... 省略 N 行
# 创建 repo 目录
mkdir /data/maven/repo -p检查 mvn 版本
1
2
3
4
5
6# mvn --version
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /usr/local/maven/apache-maven-3.8.6
Java version: 1.8.0_332, vendor: Oracle Corporation, runtime: /usr/local/java/jdk1.8.0_332/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "4.19.90-23.19.v2101.a.ky10.loongarch64", arch: "loongarch64", family: "unix"
编译 rocketmq-dashboard
下载 rocketmq-dashboard 源码
1
git clone -b rocketmq-dashboard-1.0.0 https://github.com/apache/rocketmq-dashboard.git
编译 rocketmq-dashboard
1
2cd rocketmq-dashboard/
mvn clean package -Dmaven.test.skip=true编译生成的文件为 target/rocketmq-dashboard-1.0.0.jar
构建镜像
创建 Dockerfile 文件,文件内容如下:
1
2
3
4
5
6
7
8
9
10
11
12FROM cr.loongnix.cn/library/openjdk:8-buster
ENV JAVA_OPTS=""
ENV ENV JAVA_HOME="/usr/local/openjdk-8"
ENV PATH="$JAVA_HOME/bin:$PATH"
ENV ENV LANG=C.UTF-8
ADD ./target/rocketmq-dashboard-*.jar /rocketmq-dashboard.jar
RUN sh -c 'touch /rocketmq-dashboard.jar'
CMD ["/bin/bash", "-c", "java $JAVA_OPTS -jar /rocketmq-dashboard.jar"]官方 Dockerfile 文件路径: Dockerfile
构建镜像
1
docker build -t registry-changsha.vonebaas.com/publics/rocketmq-dashboard:loong64-1.0.0 .
推送镜像
1
2
3
4
5# 登录仓库
docker login registry-changsha.vonebaas.com
# 推送镜像
docker push registry-changsha.vonebaas.com/publics/rocketmq-dashboard:loong64-1.0.0
部署 Rockermq
创建 rocketmq-dashboard.yaml 资源清单文件
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90apiVersion: v1
kind: Service
metadata:
labels:
app: rocketmq-dashboard
name: rocketmq-dashboard
namespace: publics
spec:
ports:
- port: 8080
name: http
protocol: TCP
targetPort: 8080
selector:
app: rocketmq-dashboard
type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: rocketmq-dashboard
namespace: publics
spec:
ingressClassName: traefik
rules:
- host: rocketmq-loong64.vonebaas.com
http:
paths:
- backend:
service:
name: rocketmq-dashboard
port:
number: 8080
path: /
pathType: ImplementationSpecific
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: rocketmq-dashboard
name: rocketmq-dashboard
namespace: publics
spec:
replicas: 1
selector:
matchLabels:
app: rocketmq-dashboard
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app: rocketmq-dashboard
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: groups
operator: In
values:
- vbaas
containers:
- env:
- name: JAVA_OPTS
value: "-Drocketmq.namesrv.addr=192.168.200.76:9876;192.168.200.95:9876;192.168.200.153:9876"
image: registry-changsha.vonebaas.com/publics/rocketmq-dashboard:loong64-1.0.0
imagePullPolicy: Always
name: rocketmq-dashboard
ports:
- containerPort: 8080
name: http
protocol: TCP
resources:
requests:
cpu: 100m
memory: 512Mi
imagePullSecrets:
- name: harbor-token
restartPolicy: Always
tolerations:
- effect: NoExecute
key: groups
operator: Equal
value: vbaas创建 rocketmq-dashboard 对象
1
kubectl create -f rocketmq-dashboard.yaml
配置 hosts 解析
1
111.207.111.194 rocketmq-loong64.vonebaas.com