mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-31 09:03:27 +08:00
Compare commits
73 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2672502c07 | ||
|
|
83440cc3d9 | ||
|
|
8e5f93be1c | ||
|
|
c1afc07955 | ||
|
|
4a83e14878 | ||
|
|
832320abc6 | ||
|
|
70c237da72 | ||
|
|
edfcc5c023 | ||
|
|
0668debec6 | ||
|
|
02d6463faa | ||
|
|
1fdb85234c | ||
|
|
44b7dd1808 | ||
|
|
e983ee3101 | ||
|
|
75e7e81c05 | ||
|
|
31ce3b9c08 | ||
|
|
ed93c50fef | ||
|
|
4845660eb5 | ||
|
|
c7919210a2 | ||
|
|
9491418f3b | ||
|
|
e8de403286 | ||
|
|
dfb625377b | ||
|
|
2c0f2a8be6 | ||
|
|
787d3cb3e9 | ||
|
|
96ca17d26c | ||
|
|
3dd0f7f2c3 | ||
|
|
10ba0cf976 | ||
|
|
276c15cc23 | ||
|
|
2584b848ad | ||
|
|
6471efed5f | ||
|
|
5b7d7ad65d | ||
|
|
712851a8a5 | ||
|
|
63d291cb47 | ||
|
|
f825c92111 | ||
|
|
419eb2ea41 | ||
|
|
89b58dd64e | ||
|
|
6bc5f81440 | ||
|
|
424f4b7b5e | ||
|
|
9271a1caac | ||
|
|
0ee4df03f9 | ||
|
|
8ac713ce32 | ||
|
|
76b2489fe9 | ||
|
|
6786095154 | ||
|
|
2c5793ef37 | ||
|
|
d483f25b96 | ||
|
|
7118368979 | ||
|
|
59256c2e80 | ||
|
|
1fb8a0db1e | ||
|
|
07d0c8e8fa | ||
|
|
98452ead17 | ||
|
|
d8c9f40377 | ||
|
|
8148d5eec6 | ||
|
|
4c429ad604 | ||
|
|
a9c52de8d5 | ||
|
|
f648aa1f91 | ||
|
|
eaba388bdd | ||
|
|
73e6afcbc6 | ||
|
|
8c3b72adf2 | ||
|
|
ae18ff4262 | ||
|
|
1adc8af543 | ||
|
|
7413df6f1e | ||
|
|
bda8559190 | ||
|
|
b74612fa41 | ||
|
|
22e0c20dcd | ||
|
|
08f92e1100 | ||
|
|
bb12ece46e | ||
|
|
0065438305 | ||
|
|
7f115c1b3e | ||
|
|
4e0114ab0d | ||
|
|
850d43df63 | ||
|
|
fc109fd1b1 | ||
|
|
2829947b93 | ||
|
|
a950be2d95 | ||
|
|
ba6f5ab984 |
89
README.md
89
README.md
@@ -5,66 +5,89 @@
|
|||||||
|
|
||||||
**一站式`Apache Kafka`集群指标监控与运维管控平台**
|
**一站式`Apache Kafka`集群指标监控与运维管控平台**
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 主要功能特性
|
|
||||||
|
|
||||||
### 快速体验
|
|
||||||
- 体验地址 http://117.51.146.109:8080 账号密码 admin/admin
|
|
||||||
|
|
||||||
### 集群监控维度
|
|
||||||
|
|
||||||
- 多版本集群管控,支持从`0.10.2`到`2.x`版本;
|
|
||||||
- 集群Topic、Broker等多维度历史与实时关键指标查看;
|
|
||||||
|
|
||||||
|
|
||||||
### 集群管控维度
|
阅读本README文档,您可以了解到滴滴Logi-KafkaManager的用户群体、产品定位等信息,并通过体验地址,快速体验Kafka集群指标监控与运维管控的全流程。<br>若滴滴Logi-KafkaManager已在贵司的生产环境进行使用,并想要获得官方更好地支持和指导,可以通过[`OCE认证`](http://obsuite.didiyun.com/open/openAuth),加入官方交流平台。
|
||||||
|
|
||||||
- 集群运维,包括逻辑Region方式管理集群
|
|
||||||
- Broker运维,包括优先副本选举
|
|
||||||
- Topic运维,包括创建、查询、扩容、修改属性、数据采样及迁移等;
|
|
||||||
- 消费组运维,包括指定时间或指定偏移两种方式进行重置消费偏移
|
|
||||||
|
|
||||||
|
|
||||||
### 用户使用维度
|
## 1 产品简介
|
||||||
|
滴滴Logi-KafkaManager脱胎于滴滴内部多年的Kafka运营实践经验,是面向Kafka用户、Kafka运维人员打造的共享多租户Kafka云平台。专注于Kafka运维管控、监控告警、资源治理等核心场景,经历过大规模集群、海量大数据的考验。内部满意度高达90%的同时,还与多家知名企业达成商业化合作。
|
||||||
|
|
||||||
- Kafka用户、Kafka研发、Kafka运维 视角区分
|
### 1.1 快速体验地址
|
||||||
- Kafka用户、Kafka研发、Kafka运维 权限区分
|
- 体验地址 http://117.51.146.109:8080 账号密码 admin/admin
|
||||||
|
|
||||||
|
### 1.2 体验地图
|
||||||
|
相比较于同类产品的用户视角单一(大多为管理员视角),滴滴Logi-KafkaManager建立了基于分角色、多场景视角的体验地图。分别是:**用户体验地图、运维体验地图、运营体验地图**
|
||||||
|
|
||||||
|
#### 1.2.1 用户体验地图
|
||||||
|
- 平台租户申请 :申请应用(App)作为Kafka中的用户名,并用 AppID+password作为身份验证
|
||||||
|
- 集群资源申请 :按需申请、按需使用。可使用平台提供的共享集群,也可为应用申请独立的集群
|
||||||
|
- Topic 申 请 :可根据应用(App)创建Topic,或者申请其他topic的读写权限
|
||||||
|
- Topic 运 维 :Topic数据采样、调整配额、申请分区等操作
|
||||||
|
- 指 标 监 控 :基于Topic生产消费各环节耗时统计,监控不同分位数性能指标
|
||||||
|
- 消 费 组 运 维 :支持将消费偏移重置至指定时间或指定位置
|
||||||
|
|
||||||
|
#### 1.2.2 运维体验地图
|
||||||
|
- 多版本集群管控 :支持从`0.10.2`到`2.x`版本
|
||||||
|
- 集 群 监 控 :集群Topic、Broker等多维度历史与实时关键指标查看,建立健康分体系
|
||||||
|
- 集 群 运 维 :划分部分Broker作为Region,使用Region定义资源划分单位,并按照业务、保障能力区分逻辑集群
|
||||||
|
- Broker 运 维 :包括优先副本选举等操作
|
||||||
|
- Topic 运 维 :包括创建、查询、扩容、修改属性、迁移、下线等
|
||||||
|
|
||||||
|
|
||||||
## kafka-manager架构图
|
#### 1.2.3 运营体验地图
|
||||||
|
- 资 源 治 理 :沉淀资源治理方法。针对Topic分区热点、分区不足等高频常见问题,沉淀资源治理方法,实现资源治理专家化
|
||||||
|
- 资 源 审 批 :工单体系。Topic创建、调整配额、申请分区等操作,由专业运维人员审批,规范资源使用,保障平台平稳运行
|
||||||
|
- 账 单 体 系 :成本控制。Topic资源、集群资源按需申请、按需使用。根据流量核算费用,帮助企业建设大数据成本核算体系
|
||||||
|
|
||||||
|
### 1.3 核心优势
|
||||||
|
- 高 效 的 问 题 定 位 :监控多项核心指标,统计不同分位数据,提供种类丰富的指标监控报表,帮助用户、运维人员快速高效定位问题
|
||||||
|
- 便 捷 的 集 群 运 维 :按照Region定义集群资源划分单位,将逻辑集群根据保障等级划分。在方便资源隔离、提高扩展能力的同时,实现对服务端的强管控
|
||||||
|
- 专 业 的 资 源 治 理 :基于滴滴内部多年运营实践,沉淀资源治理方法,建立健康分体系。针对Topic分区热点、分区不足等高频常见问题,实现资源治理专家化
|
||||||
|
- 友 好 的 运 维 生 态 :与滴滴夜莺监控告警系统打通,集成监控告警、集群部署、集群升级等能力。形成运维生态,凝练专家服务,使运维更高效
|
||||||
|
|
||||||
|
### 1.4 滴滴Logi-KafkaManager架构图
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
## 相关文档
|
## 2 相关文档
|
||||||
|
|
||||||
- [kafka-manager 安装手册](docs/install_guide/install_guide_cn.md)
|
### 2.1 产品文档
|
||||||
- [kafka-manager 接入集群](docs/user_guide/add_cluster/add_cluster.md)
|
- [滴滴Logi-KafkaManager 安装手册](docs/install_guide/install_guide_cn.md)
|
||||||
- [kafka-manager 用户使用手册](docs/user_guide/user_guide_cn.md)
|
- [滴滴Logi-KafkaManager 接入集群](docs/user_guide/add_cluster/add_cluster.md)
|
||||||
- [kafka-manager FAQ](docs/user_guide/faq.md)
|
- [滴滴Logi-KafkaManager 用户使用手册](docs/user_guide/user_guide_cn.md)
|
||||||
|
- [滴滴Logi-KafkaManager FAQ](docs/user_guide/faq.md)
|
||||||
|
|
||||||
## 钉钉交流群
|
### 2.2 社区文章
|
||||||
|
- [滴滴云官网产品介绍](https://www.didiyun.com/production/logi-KafkaManager.html)
|
||||||
|
- [7年沉淀之作--滴滴Logi日志服务套件](https://mp.weixin.qq.com/s/-KQp-Qo3WKEOc9wIR2iFnw)
|
||||||
|
- [滴滴Logi-KafkaManager 一站式Kafka监控与管控平台](https://mp.weixin.qq.com/s/9qSZIkqCnU6u9nLMvOOjIQ)
|
||||||
|
- [滴滴Logi-KafkaManager 开源之路](https://xie.infoq.cn/article/0223091a99e697412073c0d64)
|
||||||
|
- [滴滴Logi-KafkaManager 系列视频教程](https://mp.weixin.qq.com/s/9X7gH0tptHPtfjPPSdGO8g)
|
||||||
|
- [kafka实践(十五):滴滴开源Kafka管控平台 Logi-KafkaManager研究--A叶子叶来](https://blog.csdn.net/yezonggang/article/details/113106244)
|
||||||
|
|
||||||
|
## 3 滴滴Logi开源用户钉钉交流群
|
||||||
|
|
||||||

|

|
||||||
钉钉群ID:32821440
|
钉钉群ID:32821440
|
||||||
|
|
||||||
## OCE认证
|
## 4 OCE认证
|
||||||
OCE是一个认证机制和交流平台,为Logi-KafkaManager生产用户量身打造,我们会为OCE企业提供更好的技术支持,比如专属的技术沙龙、企业一对一的交流机会、专属的答疑群等,如果贵司Logi-KafkaManager上了生产,[快来加入吧](http://obsuite.didiyun.com/open/openAuth)
|
OCE是一个认证机制和交流平台,为滴滴Logi-KafkaManager生产用户量身打造,我们会为OCE企业提供更好的技术支持,比如专属的技术沙龙、企业一对一的交流机会、专属的答疑群等,如果贵司Logi-KafkaManager上了生产,[快来加入吧](http://obsuite.didiyun.com/open/openAuth)
|
||||||
|
|
||||||
|
|
||||||
## 项目成员
|
## 5 项目成员
|
||||||
|
|
||||||
### 内部核心人员
|
### 5.1 内部核心人员
|
||||||
|
|
||||||
`iceyuhui`、`liuyaguang`、`limengmonty`、`zhangliangmike`、`nullhuangyiming`、`zengqiao`、`eilenexuzhe`、`huangjiaweihjw`、`zhaoyinrui`、`marzkonglingxu`、`joysunchao`
|
`iceyuhui`、`liuyaguang`、`limengmonty`、`zhangliangmike`、`nullhuangyiming`、`zengqiao`、`eilenexuzhe`、`huangjiaweihjw`、`zhaoyinrui`、`marzkonglingxu`、`joysunchao`
|
||||||
|
|
||||||
|
|
||||||
### 外部贡献者
|
### 5.2 外部贡献者
|
||||||
|
|
||||||
`fangjunyu`、`zhoutaiyang`
|
`fangjunyu`、`zhoutaiyang`
|
||||||
|
|
||||||
|
|
||||||
## 协议
|
## 6 协议
|
||||||
|
|
||||||
`kafka-manager`基于`Apache-2.0`协议进行分发和使用,更多信息参见[协议文件](./LICENSE)
|
`kafka-manager`基于`Apache-2.0`协议进行分发和使用,更多信息参见[协议文件](./LICENSE)
|
||||||
|
|||||||
15
build.sh
15
build.sh
@@ -4,8 +4,9 @@ cd $workspace
|
|||||||
|
|
||||||
## constant
|
## constant
|
||||||
OUTPUT_DIR=./output
|
OUTPUT_DIR=./output
|
||||||
KM_VERSION=2.1.0
|
KM_VERSION=2.2.0
|
||||||
APP_NAME=kafka-manager-$KM_VERSION
|
APP_NAME=kafka-manager
|
||||||
|
APP_DIR=${APP_NAME}-${KM_VERSION}
|
||||||
|
|
||||||
MYSQL_TABLE_SQL_FILE=./docs/install_guide/create_mysql_table.sql
|
MYSQL_TABLE_SQL_FILE=./docs/install_guide/create_mysql_table.sql
|
||||||
CONFIG_FILE=./kafka-manager-web/src/main/resources/application.yml
|
CONFIG_FILE=./kafka-manager-web/src/main/resources/application.yml
|
||||||
@@ -28,15 +29,15 @@ function build() {
|
|||||||
function make_output() {
|
function make_output() {
|
||||||
# 新建output目录
|
# 新建output目录
|
||||||
rm -rf ${OUTPUT_DIR} &>/dev/null
|
rm -rf ${OUTPUT_DIR} &>/dev/null
|
||||||
mkdir -p ${OUTPUT_DIR}/${APP_NAME} &>/dev/null
|
mkdir -p ${OUTPUT_DIR}/${APP_DIR} &>/dev/null
|
||||||
|
|
||||||
# 填充output目录, output内的内容
|
# 填充output目录, output内的内容
|
||||||
(
|
(
|
||||||
cp -rf ${MYSQL_TABLE_SQL_FILE} ${OUTPUT_DIR}/${APP_NAME} && # 拷贝 sql 初始化脚本 至output目录
|
cp -rf ${MYSQL_TABLE_SQL_FILE} ${OUTPUT_DIR}/${APP_DIR} && # 拷贝 sql 初始化脚本 至output目录
|
||||||
cp -rf ${CONFIG_FILE} ${OUTPUT_DIR}/${APP_NAME} && # 拷贝 application.yml 至output目录
|
cp -rf ${CONFIG_FILE} ${OUTPUT_DIR}/${APP_DIR} && # 拷贝 application.yml 至output目录
|
||||||
|
|
||||||
# 拷贝程序包到output路径
|
# 拷贝程序包到output路径
|
||||||
cp kafka-manager-web/target/kafka-manager-web-${KM_VERSION}-SNAPSHOT.jar ${OUTPUT_DIR}/${APP_NAME}/${APP_NAME}-SNAPSHOT.jar
|
cp kafka-manager-web/target/kafka-manager-web-${KM_VERSION}-SNAPSHOT.jar ${OUTPUT_DIR}/${APP_DIR}/${APP_NAME}.jar
|
||||||
echo -e "make output ok."
|
echo -e "make output ok."
|
||||||
) || { echo -e "make output error"; exit 2; } # 填充output目录失败后, 退出码为 非0
|
) || { echo -e "make output error"; exit 2; } # 填充output目录失败后, 退出码为 非0
|
||||||
}
|
}
|
||||||
@@ -44,7 +45,7 @@ function make_output() {
|
|||||||
function make_package() {
|
function make_package() {
|
||||||
# 压缩output目录
|
# 压缩output目录
|
||||||
(
|
(
|
||||||
cd ${OUTPUT_DIR} && tar cvzf ${APP_NAME}.tar.gz ${APP_NAME}
|
cd ${OUTPUT_DIR} && tar cvzf ${APP_DIR}.tar.gz ${APP_DIR}
|
||||||
echo -e "make package ok."
|
echo -e "make package ok."
|
||||||
) || { echo -e "make package error"; exit 2; } # 压缩output目录失败后, 退出码为 非0
|
) || { echo -e "make package error"; exit 2; } # 压缩output目录失败后, 退出码为 非0
|
||||||
}
|
}
|
||||||
|
|||||||
44
container/dockerfiles/Dockerfile
Normal file
44
container/dockerfiles/Dockerfile
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
FROM openjdk:8-jdk-alpine3.9
|
||||||
|
|
||||||
|
LABEL author="yangvipguang"
|
||||||
|
|
||||||
|
ENV VERSION 2.1.0
|
||||||
|
ENV JAR_PATH kafka-manager-web/target
|
||||||
|
COPY $JAR_PATH/kafka-manager-web-$VERSION-SNAPSHOT.jar /tmp/app.jar
|
||||||
|
COPY $JAR_PATH/application.yml /km/
|
||||||
|
|
||||||
|
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||||
|
RUN apk add --no-cache --virtual .build-deps \
|
||||||
|
font-adobe-100dpi \
|
||||||
|
ttf-dejavu \
|
||||||
|
fontconfig \
|
||||||
|
curl \
|
||||||
|
apr \
|
||||||
|
apr-util \
|
||||||
|
apr-dev \
|
||||||
|
tomcat-native \
|
||||||
|
&& apk del .build-deps
|
||||||
|
|
||||||
|
ENV AGENT_HOME /opt/agent/
|
||||||
|
|
||||||
|
WORKDIR /tmp
|
||||||
|
COPY docker-depends/config.yaml $AGENT_HOME
|
||||||
|
COPY docker-depends/jmx_prometheus_javaagent-0.14.0.jar $AGENT_HOME
|
||||||
|
|
||||||
|
ENV JAVA_AGENT="-javaagent:$AGENT_HOME/jmx_prometheus_javaagent-0.14.0.jar=9999:$AGENT_HOME/config.yaml"
|
||||||
|
|
||||||
|
ENV JAVA_HEAP_OPTS="-Xms1024M -Xmx1024M -Xmn100M "
|
||||||
|
|
||||||
|
ENV JAVA_OPTS="-verbose:gc \
|
||||||
|
-XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintHeapAtGC -Xloggc:/tmp/gc.log -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps \
|
||||||
|
-XX:MaxMetaspaceSize=256M -XX:+DisableExplicitGC -XX:+UseStringDeduplication \
|
||||||
|
-XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError -XX:-UseContainerSupport"
|
||||||
|
#-Xlog:gc -Xlog:gc* -Xlog:gc+heap=trace -Xlog:safepoint
|
||||||
|
|
||||||
|
EXPOSE 8080 9999
|
||||||
|
|
||||||
|
ENTRYPOINT ["sh","-c","java -jar $JAVA_HEAP_OPTS $JAVA_OPTS /tmp/app.jar --spring.config.location=/km/application.yml"]
|
||||||
|
|
||||||
|
## 默认不带Prometheus JMX监控,需要可以自行取消以下注释并注释上面一行默认Entrypoint 命令。
|
||||||
|
## ENTRYPOINT ["sh","-c","java -jar $JAVA_AGENT $JAVA_HEAP_OPTS $JAVA_OPTS /tmp/app.jar --spring.config.location=/km/application.yml"]
|
||||||
|
|
||||||
5
container/dockerfiles/docker-depends/config.yaml
Normal file
5
container/dockerfiles/docker-depends/config.yaml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
startDelaySeconds: 0
|
||||||
|
ssl: false
|
||||||
|
lowercaseOutputName: false
|
||||||
|
lowercaseOutputLabelNames: false
|
||||||
23
container/helm/.helmignore
Normal file
23
container/helm/.helmignore
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Patterns to ignore when building packages.
|
||||||
|
# This supports shell glob matching, relative path matching, and
|
||||||
|
# negation (prefixed with !). Only one pattern per line.
|
||||||
|
.DS_Store
|
||||||
|
# Common VCS dirs
|
||||||
|
.git/
|
||||||
|
.gitignore
|
||||||
|
.bzr/
|
||||||
|
.bzrignore
|
||||||
|
.hg/
|
||||||
|
.hgignore
|
||||||
|
.svn/
|
||||||
|
# Common backup files
|
||||||
|
*.swp
|
||||||
|
*.bak
|
||||||
|
*.tmp
|
||||||
|
*.orig
|
||||||
|
*~
|
||||||
|
# Various IDEs
|
||||||
|
.project
|
||||||
|
.idea/
|
||||||
|
*.tmproj
|
||||||
|
.vscode/
|
||||||
24
container/helm/Chart.yaml
Normal file
24
container/helm/Chart.yaml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
name: didi-km
|
||||||
|
description: A Helm chart for Kubernetes
|
||||||
|
|
||||||
|
# A chart can be either an 'application' or a 'library' chart.
|
||||||
|
#
|
||||||
|
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||||
|
# to be deployed.
|
||||||
|
#
|
||||||
|
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||||
|
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||||
|
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||||
|
type: application
|
||||||
|
|
||||||
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
|
# to the chart and its templates, including the app version.
|
||||||
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
|
version: 0.1.0
|
||||||
|
|
||||||
|
# This is the version number of the application being deployed. This version number should be
|
||||||
|
# incremented each time you make changes to the application. Versions are not expected to
|
||||||
|
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||||
|
# It is recommended to use it with quotes.
|
||||||
|
appVersion: "1.16.0"
|
||||||
22
container/helm/templates/NOTES.txt
Normal file
22
container/helm/templates/NOTES.txt
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
1. Get the application URL by running these commands:
|
||||||
|
{{- if .Values.ingress.enabled }}
|
||||||
|
{{- range $host := .Values.ingress.hosts }}
|
||||||
|
{{- range .paths }}
|
||||||
|
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else if contains "NodePort" .Values.service.type }}
|
||||||
|
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "didi-km.fullname" . }})
|
||||||
|
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||||
|
echo http://$NODE_IP:$NODE_PORT
|
||||||
|
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||||
|
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||||
|
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "didi-km.fullname" . }}'
|
||||||
|
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "didi-km.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
|
||||||
|
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||||
|
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||||
|
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "didi-km.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||||
|
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
|
||||||
|
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||||
|
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
|
||||||
|
{{- end }}
|
||||||
62
container/helm/templates/_helpers.tpl
Normal file
62
container/helm/templates/_helpers.tpl
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
{{/*
|
||||||
|
Expand the name of the chart.
|
||||||
|
*/}}
|
||||||
|
{{- define "didi-km.name" -}}
|
||||||
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create a default fully qualified app name.
|
||||||
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||||
|
If release name contains chart name it will be used as a full name.
|
||||||
|
*/}}
|
||||||
|
{{- define "didi-km.fullname" -}}
|
||||||
|
{{- if .Values.fullnameOverride }}
|
||||||
|
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- else }}
|
||||||
|
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||||
|
{{- if contains $name .Release.Name }}
|
||||||
|
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- else }}
|
||||||
|
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create chart name and version as used by the chart label.
|
||||||
|
*/}}
|
||||||
|
{{- define "didi-km.chart" -}}
|
||||||
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Common labels
|
||||||
|
*/}}
|
||||||
|
{{- define "didi-km.labels" -}}
|
||||||
|
helm.sh/chart: {{ include "didi-km.chart" . }}
|
||||||
|
{{ include "didi-km.selectorLabels" . }}
|
||||||
|
{{- if .Chart.AppVersion }}
|
||||||
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||||
|
{{- end }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Selector labels
|
||||||
|
*/}}
|
||||||
|
{{- define "didi-km.selectorLabels" -}}
|
||||||
|
app.kubernetes.io/name: {{ include "didi-km.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the service account to use
|
||||||
|
*/}}
|
||||||
|
{{- define "didi-km.serviceAccountName" -}}
|
||||||
|
{{- if .Values.serviceAccount.create }}
|
||||||
|
{{- default (include "didi-km.fullname" .) .Values.serviceAccount.name }}
|
||||||
|
{{- else }}
|
||||||
|
{{- default "default" .Values.serviceAccount.name }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
88
container/helm/templates/configmap.yaml
Normal file
88
container/helm/templates/configmap.yaml
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: km-cm
|
||||||
|
data:
|
||||||
|
application.yml: |
|
||||||
|
server:
|
||||||
|
port: 8080
|
||||||
|
tomcat:
|
||||||
|
accept-count: 1000
|
||||||
|
max-connections: 10000
|
||||||
|
max-threads: 800
|
||||||
|
min-spare-threads: 100
|
||||||
|
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: kafkamanager
|
||||||
|
datasource:
|
||||||
|
kafka-manager:
|
||||||
|
jdbc-url: jdbc:mysql://xxxxx:3306/kafka-manager?characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=false
|
||||||
|
username: admin
|
||||||
|
password: admin
|
||||||
|
driver-class-name: com.mysql.jdbc.Driver
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
|
||||||
|
profiles:
|
||||||
|
active: dev
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
max-file-size: 100MB
|
||||||
|
max-request-size: 100MB
|
||||||
|
|
||||||
|
logging:
|
||||||
|
config: classpath:logback-spring.xml
|
||||||
|
|
||||||
|
custom:
|
||||||
|
idc: cn
|
||||||
|
jmx:
|
||||||
|
max-conn: 20
|
||||||
|
store-metrics-task:
|
||||||
|
community:
|
||||||
|
broker-metrics-enabled: true
|
||||||
|
topic-metrics-enabled: true
|
||||||
|
didi:
|
||||||
|
app-topic-metrics-enabled: false
|
||||||
|
topic-request-time-metrics-enabled: false
|
||||||
|
topic-throttled-metrics: false
|
||||||
|
save-days: 7
|
||||||
|
|
||||||
|
# 任务相关的开关
|
||||||
|
task:
|
||||||
|
op:
|
||||||
|
sync-topic-enabled: false # 未落盘的Topic定期同步到DB中
|
||||||
|
|
||||||
|
account:
|
||||||
|
ldap:
|
||||||
|
|
||||||
|
kcm:
|
||||||
|
enabled: false
|
||||||
|
storage:
|
||||||
|
base-url: http://127.0.0.1
|
||||||
|
n9e:
|
||||||
|
base-url: http://127.0.0.1:8004
|
||||||
|
user-token: 12345678
|
||||||
|
timeout: 300
|
||||||
|
account: root
|
||||||
|
script-file: kcm_script.sh
|
||||||
|
|
||||||
|
monitor:
|
||||||
|
enabled: false
|
||||||
|
n9e:
|
||||||
|
nid: 2
|
||||||
|
user-token: 1234567890
|
||||||
|
mon:
|
||||||
|
base-url: http://127.0.0.1:8032
|
||||||
|
sink:
|
||||||
|
base-url: http://127.0.0.1:8006
|
||||||
|
rdb:
|
||||||
|
base-url: http://127.0.0.1:80
|
||||||
|
|
||||||
|
notify:
|
||||||
|
kafka:
|
||||||
|
cluster-id: 95
|
||||||
|
topic-name: didi-kafka-notify
|
||||||
|
order:
|
||||||
|
detail-url: http://127.0.0.1
|
||||||
|
|
||||||
56
container/helm/templates/deployment.yaml
Normal file
56
container/helm/templates/deployment.yaml
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ include "didi-km.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "didi-km.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
{{- if not .Values.autoscaling.enabled }}
|
||||||
|
replicas: {{ .Values.replicaCount }}
|
||||||
|
{{- end }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "didi-km.selectorLabels" . | nindent 6 }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
{{- with .Values.podAnnotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
{{- include "didi-km.selectorLabels" . | nindent 8 }}
|
||||||
|
spec:
|
||||||
|
{{- with .Values.imagePullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
serviceAccountName: {{ include "didi-km.serviceAccountName" . }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||||
|
containers:
|
||||||
|
- name: {{ .Chart.Name }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||||
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: 8080
|
||||||
|
protocol: TCP
|
||||||
|
- name: jmx-metrics
|
||||||
|
containerPort: 9999
|
||||||
|
protocol: TCP
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.resources | nindent 12 }}
|
||||||
|
{{- with .Values.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
28
container/helm/templates/hpa.yaml
Normal file
28
container/helm/templates/hpa.yaml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{{- if .Values.autoscaling.enabled }}
|
||||||
|
apiVersion: autoscaling/v2beta1
|
||||||
|
kind: HorizontalPodAutoscaler
|
||||||
|
metadata:
|
||||||
|
name: {{ include "didi-km.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "didi-km.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
scaleTargetRef:
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
name: {{ include "didi-km.fullname" . }}
|
||||||
|
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
||||||
|
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
||||||
|
metrics:
|
||||||
|
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||||
|
- type: Resource
|
||||||
|
resource:
|
||||||
|
name: cpu
|
||||||
|
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||||
|
- type: Resource
|
||||||
|
resource:
|
||||||
|
name: memory
|
||||||
|
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
41
container/helm/templates/ingress.yaml
Normal file
41
container/helm/templates/ingress.yaml
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{{- if .Values.ingress.enabled -}}
|
||||||
|
{{- $fullName := include "didi-km.fullname" . -}}
|
||||||
|
{{- $svcPort := .Values.service.port -}}
|
||||||
|
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||||
|
apiVersion: networking.k8s.io/v1beta1
|
||||||
|
{{- else -}}
|
||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
{{- end }}
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: {{ $fullName }}
|
||||||
|
labels:
|
||||||
|
{{- include "didi-km.labels" . | nindent 4 }}
|
||||||
|
{{- with .Values.ingress.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- if .Values.ingress.tls }}
|
||||||
|
tls:
|
||||||
|
{{- range .Values.ingress.tls }}
|
||||||
|
- hosts:
|
||||||
|
{{- range .hosts }}
|
||||||
|
- {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
secretName: {{ .secretName }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
rules:
|
||||||
|
{{- range .Values.ingress.hosts }}
|
||||||
|
- host: {{ .host | quote }}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
{{- range .paths }}
|
||||||
|
- path: {{ .path }}
|
||||||
|
backend:
|
||||||
|
serviceName: {{ $fullName }}
|
||||||
|
servicePort: {{ $svcPort }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
15
container/helm/templates/service.yaml
Normal file
15
container/helm/templates/service.yaml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ include "didi-km.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "didi-km.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
type: {{ .Values.service.type }}
|
||||||
|
ports:
|
||||||
|
- port: {{ .Values.service.port }}
|
||||||
|
targetPort: http
|
||||||
|
protocol: TCP
|
||||||
|
name: http
|
||||||
|
selector:
|
||||||
|
{{- include "didi-km.selectorLabels" . | nindent 4 }}
|
||||||
12
container/helm/templates/serviceaccount.yaml
Normal file
12
container/helm/templates/serviceaccount.yaml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{{- if .Values.serviceAccount.create -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: {{ include "didi-km.serviceAccountName" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "didi-km.labels" . | nindent 4 }}
|
||||||
|
{{- with .Values.serviceAccount.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
15
container/helm/templates/tests/test-connection.yaml
Normal file
15
container/helm/templates/tests/test-connection.yaml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: "{{ include "didi-km.fullname" . }}-test-connection"
|
||||||
|
labels:
|
||||||
|
{{- include "didi-km.labels" . | nindent 4 }}
|
||||||
|
annotations:
|
||||||
|
"helm.sh/hook": test
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: wget
|
||||||
|
image: busybox
|
||||||
|
command: ['wget']
|
||||||
|
args: ['{{ include "didi-km.fullname" . }}:{{ .Values.service.port }}']
|
||||||
|
restartPolicy: Never
|
||||||
79
container/helm/values.yaml
Normal file
79
container/helm/values.yaml
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
# Default values for didi-km.
|
||||||
|
# This is a YAML-formatted file.
|
||||||
|
# Declare variables to be passed into your templates.
|
||||||
|
|
||||||
|
replicaCount: 1
|
||||||
|
|
||||||
|
image:
|
||||||
|
repository: docker.io/yangvipguang/km
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
# Overrides the image tag whose default is the chart appVersion.
|
||||||
|
tag: "v18"
|
||||||
|
|
||||||
|
imagePullSecrets: []
|
||||||
|
nameOverride: ""
|
||||||
|
fullnameOverride: "km"
|
||||||
|
|
||||||
|
serviceAccount:
|
||||||
|
# Specifies whether a service account should be created
|
||||||
|
create: true
|
||||||
|
# Annotations to add to the service account
|
||||||
|
annotations: {}
|
||||||
|
# The name of the service account to use.
|
||||||
|
# If not set and create is true, a name is generated using the fullname template
|
||||||
|
name: ""
|
||||||
|
|
||||||
|
podAnnotations: {}
|
||||||
|
|
||||||
|
podSecurityContext: {}
|
||||||
|
# fsGroup: 2000
|
||||||
|
|
||||||
|
securityContext: {}
|
||||||
|
# capabilities:
|
||||||
|
# drop:
|
||||||
|
# - ALL
|
||||||
|
# readOnlyRootFilesystem: true
|
||||||
|
# runAsNonRoot: true
|
||||||
|
# runAsUser: 1000
|
||||||
|
|
||||||
|
service:
|
||||||
|
type: ClusterIP
|
||||||
|
port: 8080
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
enabled: false
|
||||||
|
annotations: {}
|
||||||
|
# kubernetes.io/ingress.class: nginx
|
||||||
|
# kubernetes.io/tls-acme: "true"
|
||||||
|
hosts:
|
||||||
|
- host: chart-example.local
|
||||||
|
paths: []
|
||||||
|
tls: []
|
||||||
|
# - secretName: chart-example-tls
|
||||||
|
# hosts:
|
||||||
|
# - chart-example.local
|
||||||
|
|
||||||
|
resources:
|
||||||
|
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||||
|
# choice for the user. This also increases chances charts run on environments with little
|
||||||
|
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||||
|
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||||
|
limits:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 2048Mi
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
memory: 200Mi
|
||||||
|
|
||||||
|
autoscaling:
|
||||||
|
enabled: false
|
||||||
|
minReplicas: 1
|
||||||
|
maxReplicas: 100
|
||||||
|
targetCPUUtilizationPercentage: 80
|
||||||
|
# targetMemoryUtilizationPercentage: 80
|
||||||
|
|
||||||
|
nodeSelector: {}
|
||||||
|
|
||||||
|
tolerations: []
|
||||||
|
|
||||||
|
affinity: {}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 150 KiB |
BIN
docs/dev_guide/assets/connect_jmx_failed/check_jmx_opened.jpg
Normal file
BIN
docs/dev_guide/assets/connect_jmx_failed/check_jmx_opened.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 382 KiB |
101
docs/dev_guide/connect_jmx_failed.md
Normal file
101
docs/dev_guide/connect_jmx_failed.md
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
**一站式`Apache Kafka`集群指标监控与运维管控平台**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## JMX-连接失败问题解决
|
||||||
|
|
||||||
|
集群正常接入Logi-KafkaManager之后,即可以看到集群的Broker列表,此时如果查看不了Topic的实时流量,或者是Broker的实时流量信息时,那么大概率就是JMX连接的问题了。
|
||||||
|
|
||||||
|
下面我们按照步骤来一步一步的检查。
|
||||||
|
|
||||||
|
### 1、问题&说明
|
||||||
|
|
||||||
|
**类型一:JMX配置未开启**
|
||||||
|
|
||||||
|
未开启时,直接到`2、解决方法`查看如何开启即可。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
**类型二:配置错误**
|
||||||
|
|
||||||
|
`JMX`端口已经开启的情况下,有的时候开启的配置不正确,此时也会导致出现连接失败的问题。这里大概列举几种原因:
|
||||||
|
|
||||||
|
- `JMX`配置错误:见`2、解决方法`。
|
||||||
|
- 存在防火墙或者网络限制:网络通的另外一台机器`telnet`试一下看是否可以连接上。
|
||||||
|
- 需要进行用户名及密码的认证:见`3、解决方法 —— 认证的JMX`。
|
||||||
|
|
||||||
|
|
||||||
|
错误日志例子:
|
||||||
|
```
|
||||||
|
# 错误一: 错误提示的是真实的IP,这样的话基本就是JMX配置的有问题了。
|
||||||
|
2021-01-27 10:06:20.730 ERROR 50901 --- [ics-Thread-1-62] c.x.k.m.c.utils.jmx.JmxConnectorWrap : JMX connect exception, host:192.168.0.1 port:9999.
|
||||||
|
java.rmi.ConnectException: Connection refused to host: 192.168.0.1; nested exception is:
|
||||||
|
|
||||||
|
|
||||||
|
# 错误二:错误提示的是127.0.0.1这个IP,这个是机器的hostname配置的可能有问题。
|
||||||
|
2021-01-27 10:06:20.730 ERROR 50901 --- [ics-Thread-1-62] c.x.k.m.c.utils.jmx.JmxConnectorWrap : JMX connect exception, host:127.0.0.1 port:9999.
|
||||||
|
java.rmi.ConnectException: Connection refused to host: 127.0.0.1;; nested exception is:
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2、解决方法
|
||||||
|
|
||||||
|
这里仅介绍一下比较通用的解决方式,如若有更好的方式,欢迎大家指导告知一下。
|
||||||
|
|
||||||
|
修改`kafka-server-start.sh`文件:
|
||||||
|
```
|
||||||
|
# 在这个下面增加JMX端口的配置
|
||||||
|
if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
|
||||||
|
export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"
|
||||||
|
export JMX_PORT=9999 # 增加这个配置, 这里的数值并不一定是要9999
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
修改`kafka-run-class.sh`文件
|
||||||
|
```
|
||||||
|
# JMX settings
|
||||||
|
if [ -z "$KAFKA_JMX_OPTS" ]; then
|
||||||
|
KAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=${当前机器的IP}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# JMX port to use
|
||||||
|
if [ $JMX_PORT ]; then
|
||||||
|
KAFKA_JMX_OPTS="$KAFKA_JMX_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT"
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### 3、解决方法 —— 认证的JMX
|
||||||
|
|
||||||
|
如果您是直接看的这个部分,建议先看一下上一节:`2、解决方法`以确保`JMX`的配置没有问题了。
|
||||||
|
|
||||||
|
在JMX的配置等都没有问题的情况下,如果是因为认证的原因导致连接不了的,此时可以使用下面介绍的方法进行解决。
|
||||||
|
|
||||||
|
**当前这块后端刚刚开发完成,可能还不够完善,有问题随时沟通。**
|
||||||
|
|
||||||
|
`Logi-KafkaManager 2.2.0+`之后的版本后端已经支持`JMX`认证方式的连接,但是还没有界面,此时我们可以往`cluster`表的`jmx_properties`字段写入`JMX`的认证信息。
|
||||||
|
|
||||||
|
这个数据是`json`格式的字符串,例子如下所示:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"maxConn": 10, # KM对单台Broker的最大JMX连接数
|
||||||
|
"username": "xxxxx", # 用户名
|
||||||
|
"password": "xxxx", # 密码
|
||||||
|
"openSSL": true, # 开启SSL, true表示开启ssl, false表示关闭
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SQL的例子:
|
||||||
|
```sql
|
||||||
|
UPDATE cluster SET jmx_properties='{ "maxConn": 10, "username": "xxxxx", "password": "xxxx", "openSSL": false }' where id={xxx};
|
||||||
|
```
|
||||||
27
docs/dev_guide/upgrade_manual/logi-km-v2.2.0.md
Normal file
27
docs/dev_guide/upgrade_manual/logi-km-v2.2.0.md
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
**一站式`Apache Kafka`集群指标监控与运维管控平台**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 升级至`2.2.0`版本
|
||||||
|
|
||||||
|
`2.2.0`版本在`cluster`表及`logical_cluster`各增加了一个字段,因此需要执行下面的sql进行字段的增加。
|
||||||
|
|
||||||
|
```sql
|
||||||
|
# 往cluster表中增加jmx_properties字段, 这个字段会用于存储jmx相关的认证以及配置信息
|
||||||
|
ALTER TABLE `cluster` ADD COLUMN `jmx_properties` TEXT NULL COMMENT 'JMX配置' AFTER `security_properties`;
|
||||||
|
|
||||||
|
# 往logical_cluster中增加identification字段, 同时数据和原先name数据相同, 最后增加一个唯一键.
|
||||||
|
# 此后, name字段还是表示集群名称, 而identification字段表示的是集群标识, 只能是字母数字及下划线组成,
|
||||||
|
# 数据上报到监控系统时, 集群这个标识采用的字段就是identification字段, 之前使用的是name字段.
|
||||||
|
ALTER TABLE `logical_cluster` ADD COLUMN `identification` VARCHAR(192) NOT NULL DEFAULT '' COMMENT '逻辑集群标识' AFTER `name`;
|
||||||
|
|
||||||
|
UPDATE `logical_cluster` SET `identification`=`name` WHERE id>=0;
|
||||||
|
|
||||||
|
ALTER TABLE `logical_cluster` ADD INDEX `uniq_identification` (`identification` ASC);
|
||||||
|
```
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
当前因为无法同时兼容`MySQL 8`与`MySQL 5.7`,因此代码中默认的版本还是`MySQL 5.7`。
|
当前因为无法同时兼容`MySQL 8`与`MySQL 5.7`,因此代码中默认的版本还是`MySQL 5.7`。
|
||||||
|
|
||||||
|
|
||||||
当前如需使用`MySQL 8`,则续按照下述流程进行简单修改代码。
|
当前如需使用`MySQL 8`,则需按照下述流程进行简单修改代码。
|
||||||
|
|
||||||
|
|
||||||
- Step1. 修改application.yml中的MySQL驱动类
|
- Step1. 修改application.yml中的MySQL驱动类
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
-- create database
|
||||||
|
CREATE DATABASE logi_kafka_manager;
|
||||||
|
|
||||||
|
USE logi_kafka_manager;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `account`
|
-- Table structure for table `account`
|
||||||
--
|
--
|
||||||
@@ -104,7 +109,8 @@ CREATE TABLE `cluster` (
|
|||||||
`zookeeper` varchar(512) NOT NULL DEFAULT '' COMMENT 'zk地址',
|
`zookeeper` varchar(512) NOT NULL DEFAULT '' COMMENT 'zk地址',
|
||||||
`bootstrap_servers` varchar(512) NOT NULL DEFAULT '' COMMENT 'server地址',
|
`bootstrap_servers` varchar(512) NOT NULL DEFAULT '' COMMENT 'server地址',
|
||||||
`kafka_version` varchar(32) NOT NULL DEFAULT '' COMMENT 'kafka版本',
|
`kafka_version` varchar(32) NOT NULL DEFAULT '' COMMENT 'kafka版本',
|
||||||
`security_properties` text COMMENT '安全认证参数',
|
`security_properties` text COMMENT 'Kafka安全认证参数',
|
||||||
|
`jmx_properties` text COMMENT 'JMX配置',
|
||||||
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT ' 监控标记, 0表示未监控, 1表示监控中',
|
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT ' 监控标记, 0表示未监控, 1表示监控中',
|
||||||
`gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
`gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
`gmt_modify` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
`gmt_modify` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||||
@@ -302,20 +308,22 @@ INSERT INTO kafka_user(app_id, password, user_type, operation) VALUES ('dkm_admi
|
|||||||
-- Table structure for table `logical_cluster`
|
-- Table structure for table `logical_cluster`
|
||||||
--
|
--
|
||||||
|
|
||||||
-- DROP TABLE IF EXISTS `logical_cluster`;
|
|
||||||
CREATE TABLE `logical_cluster` (
|
CREATE TABLE `logical_cluster` (
|
||||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||||
`name` varchar(192) NOT NULL DEFAULT '' COMMENT '逻辑集群名称',
|
`name` varchar(192) NOT NULL DEFAULT '' COMMENT '逻辑集群名称',
|
||||||
`mode` int(16) NOT NULL DEFAULT '0' COMMENT '逻辑集群类型, 0:共享集群, 1:独享集群, 2:独立集群',
|
`identification` varchar(192) NOT NULL DEFAULT '' COMMENT '逻辑集群标识',
|
||||||
`app_id` varchar(64) NOT NULL DEFAULT '' COMMENT '所属应用',
|
`mode` int(16) NOT NULL DEFAULT '0' COMMENT '逻辑集群类型, 0:共享集群, 1:独享集群, 2:独立集群',
|
||||||
`cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群id',
|
`app_id` varchar(64) NOT NULL DEFAULT '' COMMENT '所属应用',
|
||||||
`region_list` varchar(256) NOT NULL DEFAULT '' COMMENT 'regionid列表',
|
`cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群id',
|
||||||
`description` text COMMENT '备注说明',
|
`region_list` varchar(256) NOT NULL DEFAULT '' COMMENT 'regionid列表',
|
||||||
`gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
`description` text COMMENT '备注说明',
|
||||||
`gmt_modify` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
`gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
PRIMARY KEY (`id`),
|
`gmt_modify` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||||
UNIQUE KEY `uniq_name` (`name`)
|
PRIMARY KEY (`id`),
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='逻辑集群信息表';
|
UNIQUE KEY `uniq_name` (`name`),
|
||||||
|
UNIQUE KEY `uniq_identification` (`identification`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='逻辑集群信息表';
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `monitor_rule`
|
-- Table structure for table `monitor_rule`
|
||||||
|
|||||||
@@ -9,19 +9,39 @@
|
|||||||
|
|
||||||
# 安装手册
|
# 安装手册
|
||||||
|
|
||||||
|
## 1、环境依赖
|
||||||
|
|
||||||
## 环境依赖
|
如果是以Release包进行安装的,则仅安装`Java`及`MySQL`即可。如果是要先进行源码包进行打包,然后再使用,则需要安装`Maven`及`Node`环境。
|
||||||
|
|
||||||
- `Maven 3.5+`(后端打包依赖)
|
|
||||||
- `node v12+`(前端打包依赖)
|
|
||||||
- `Java 8+`(运行环境需要)
|
- `Java 8+`(运行环境需要)
|
||||||
- `MySQL 5.7`(数据存储)
|
- `MySQL 5.7`(数据存储)
|
||||||
|
- `Maven 3.5+`(后端打包依赖)
|
||||||
|
- `Node 10+`(前端打包依赖)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 环境初始化
|
## 2、获取安装包
|
||||||
|
|
||||||
执行[create_mysql_table.sql](create_mysql_table.sql)中的SQL命令,从而创建所需的MySQL库及表,默认创建的库名是`kafka_manager`。
|
**1、Release直接下载**
|
||||||
|
|
||||||
|
这里如果觉得麻烦,然后也不想进行二次开发,则可以直接下载Release包,下载地址:[Github Release包下载地址](https://github.com/didi/Logi-KafkaManager/releases)
|
||||||
|
|
||||||
|
如果觉得Github的下载地址太慢了,也可以进入`Logi-KafkaManager`的用户群获取,群地址在README中。
|
||||||
|
|
||||||
|
|
||||||
|
**2、源代码进行打包**
|
||||||
|
|
||||||
|
下载好代码之后,进入`Logi-KafkaManager`的主目录,执行`sh build.sh`命令即可,执行完成之后会在`output/kafka-manager-xxx`目录下面生成一个jar包。
|
||||||
|
|
||||||
|
对于`windows`环境的用户,估计执行不了`sh build.sh`命令,因此可以直接执行`mvn install`,然后在`kafka-manager-web/target`目录下生成一个kafka-manager-web-xxx.jar的包。
|
||||||
|
|
||||||
|
获取到jar包之后,我们继续下面的步骤。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3、MySQL-DB初始化
|
||||||
|
|
||||||
|
执行[create_mysql_table.sql](create_mysql_table.sql)中的SQL命令,从而创建所需的MySQL库及表,默认创建的库名是`logi_kafka_manager`。
|
||||||
|
|
||||||
```
|
```
|
||||||
# 示例:
|
# 示例:
|
||||||
@@ -30,29 +50,15 @@ mysql -uXXXX -pXXX -h XXX.XXX.XXX.XXX -PXXXX < ./create_mysql_table.sql
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 打包
|
## 4、启动
|
||||||
|
|
||||||
```bash
|
|
||||||
|
|
||||||
# 一次性打包
|
|
||||||
cd ..
|
|
||||||
mvn install
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
# application.yml 是配置文件,最简单的是仅修改MySQL相关的配置即可启动
|
||||||
|
|
||||||
---
|
nohup java -jar kafka-manager.jar --spring.config.location=./application.yml > /dev/null 2>&1 &
|
||||||
|
|
||||||
## 启动
|
|
||||||
|
|
||||||
```
|
|
||||||
# application.yml 是配置文件
|
|
||||||
|
|
||||||
cp kafka-manager-web/src/main/resources/application.yml kafka-manager-web/target/
|
|
||||||
cd kafka-manager-web/target/
|
|
||||||
nohup java -jar kafka-manager-web-2.1.0-SNAPSHOT.jar --spring.config.location=./application.yml > /dev/null 2>&1 &
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## 使用
|
### 5、使用
|
||||||
|
|
||||||
本地启动的话,访问`http://localhost:8080`,输入帐号及密码(默认`admin/admin`)进行登录。更多参考:[kafka-manager 用户使用手册](../user_guide/user_guide_cn.md)
|
本地启动的话,访问`http://localhost:8080`,输入帐号及密码(默认`admin/admin`)进行登录。更多参考:[kafka-manager 用户使用手册](../user_guide/user_guide_cn.md)
|
||||||
|
|
||||||
|
|||||||
@@ -5,16 +5,26 @@
|
|||||||
|
|
||||||
**一站式`Apache Kafka`集群指标监控与运维管控平台**
|
**一站式`Apache Kafka`集群指标监控与运维管控平台**
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# 集群接入
|
# 集群接入
|
||||||
|
|
||||||
集群的接入总共需要三个步骤,分别是:
|
## 主要概念讲解
|
||||||
1. 接入物理集群
|
面对大规模集群、业务场景复杂的情况,引入Region、逻辑集群的概念
|
||||||
2. 创建Region
|
- Region:划分部分Broker作为一个 Region,用Region定义资源划分的单位,提高扩展性和隔离性。如果部分Topic异常也不会影响大面积的Broker
|
||||||
3. 创建逻辑集群
|
- 逻辑集群:逻辑集群由部分Region组成,便于对大规模集群按照业务划分、保障能力进行管理
|
||||||
|

|
||||||
|
|
||||||
备注:接入集群需要2、3两步是因为普通用户的视角下,看到的都是逻辑集群,如果没有2、3两步,那么普通用户看不到任何信息。
|
集群的接入总共需要三个步骤,分别是:
|
||||||
|
1. 接入物理集群:填写机器地址、安全协议等配置信息,接入真实的物理集群
|
||||||
|
2. 创建Region:将部分Broker划分为一个Region
|
||||||
|
3. 创建逻辑集群:逻辑集群由部分Region组成,可根据业务划分、保障等级来创建相应的逻辑集群
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
**备注:接入集群需要2、3两步是因为普通用户的视角下,看到的都是逻辑集群,如果没有2、3两步,那么普通用户看不到任何信息。**
|
||||||
|
|
||||||
|
|
||||||
## 1、接入物理集群
|
## 1、接入物理集群
|
||||||
|
|||||||
BIN
docs/user_guide/add_cluster/assets/op_cluster_arch.png
Normal file
BIN
docs/user_guide/add_cluster/assets/op_cluster_arch.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 124 KiB |
BIN
docs/user_guide/add_cluster/assets/op_cluster_flow.png
Normal file
BIN
docs/user_guide/add_cluster/assets/op_cluster_flow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 105 KiB |
@@ -1,4 +1,4 @@
|
|||||||
)
|

|
||||||
|
|
||||||
**一站式`Apache Kafka`集群指标监控与运维管控平台**
|
**一站式`Apache Kafka`集群指标监控与运维管控平台**
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 119 KiB |
@@ -9,18 +9,41 @@
|
|||||||
|
|
||||||
# FAQ
|
# FAQ
|
||||||
|
|
||||||
- 1、Topic申请时没有可选择的集群?
|
- 0、Github图裂问题解决
|
||||||
|
- 1、Topic申请、新建监控告警等操作时没有可选择的集群?
|
||||||
- 2、逻辑集群 & Region的用途?
|
- 2、逻辑集群 & Region的用途?
|
||||||
- 3、登录失败?
|
- 3、登录失败?
|
||||||
- 4、页面流量信息等无数据?
|
- 4、页面流量信息等无数据?
|
||||||
- 5、如何对接夜莺的监控告警功能?
|
- 5、如何对接夜莺的监控告警功能?
|
||||||
- 6、如何使用`MySQL 8`?
|
- 6、如何使用`MySQL 8`?
|
||||||
|
- 7、`Jmx`连接失败如何解决?
|
||||||
|
- 8、`topic biz data not exist`错误及处理方式
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 1、Topic申请时没有可选择的集群?
|
### 0、Github图裂问题解决
|
||||||
|
|
||||||
- 参看 [kafka-manager 接入集群](docs/user_guide/add_cluster/add_cluster.md) 手册,这里的Region和逻辑集群都必须添加。
|
可以在本地机器`ping github.com`这个地址,获取到`github.com`地址的IP地址。
|
||||||
|
|
||||||
|
然后将IP绑定到`/etc/hosts`文件中。
|
||||||
|
|
||||||
|
例如
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# 在 /etc/hosts文件中增加如下信息
|
||||||
|
|
||||||
|
140.82.113.3 github.com
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 1、Topic申请、新建监控告警等操作时没有可选择的集群?
|
||||||
|
|
||||||
|
缺少逻辑集群导致的,在Topic管理、监控告警、集群管理这三个Tab下面都是普通用户视角,普通用户看到的集群都是逻辑集群,因此在这三个Tab下进行操作时,都需要有逻辑集群。
|
||||||
|
|
||||||
|
逻辑集群的创建参看:
|
||||||
|
|
||||||
|
- [kafka-manager 接入集群](docs/user_guide/add_cluster/add_cluster.md) 手册,这里的Region和逻辑集群都必须添加。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -29,7 +52,7 @@
|
|||||||
主要用途是进行大集群的管理 & 集群细节的屏蔽。
|
主要用途是进行大集群的管理 & 集群细节的屏蔽。
|
||||||
|
|
||||||
- 逻辑集群:通过逻辑集群概念,将集群Broker按业务进行归类,方便管理;
|
- 逻辑集群:通过逻辑集群概念,将集群Broker按业务进行归类,方便管理;
|
||||||
- Region:通过引入Region,同时Topic按Region维度创建,减少Broker间的连接;
|
- Region:通过引入Region,同时Topic按Region纬度创建,减少Broker间的连接;
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -43,7 +66,7 @@
|
|||||||
|
|
||||||
- 1、检查`Broker JMX`是否正确开启。
|
- 1、检查`Broker JMX`是否正确开启。
|
||||||
|
|
||||||
如若还未开启,具体可百度一下看如何开启。
|
如若还未开启,具体可百度一下看如何开启,或者参看:[Jmx连接配置&问题解决说明文档](../dev_guide/connect_jmx_failed.md)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -53,7 +76,7 @@
|
|||||||
|
|
||||||
- 3、数据库时区问题。
|
- 3、数据库时区问题。
|
||||||
|
|
||||||
检查MySQL的topic_metrics、broker_metrics表,查看是否有数据,如果有数据,那么再检查设置的时区是否正确。
|
检查MySQL的topic表,查看是否有数据,如果有数据,那么再检查设置的时区是否正确。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -66,3 +89,23 @@
|
|||||||
### 6、如何使用`MySQL 8`?
|
### 6、如何使用`MySQL 8`?
|
||||||
|
|
||||||
- 参看 [kafka-manager 使用`MySQL 8`](../dev_guide/use_mysql_8.md) 说明。
|
- 参看 [kafka-manager 使用`MySQL 8`](../dev_guide/use_mysql_8.md) 说明。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 7、`Jmx`连接失败如何解决?
|
||||||
|
|
||||||
|
- 参看 [Jmx连接配置&问题解决](../dev_guide/connect_jmx_failed.md) 说明。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 8、`topic biz data not exist`错误及处理方式
|
||||||
|
|
||||||
|
**错误原因**
|
||||||
|
|
||||||
|
在进行权限审批的时候,可能会出现这个错误,出现这个错误的原因是因为Topic相关的业务信息没有在DB中存储,或者更具体的说就是该Topic不属于任何应用导致的,只需要将这些无主的Topic挂在某个应用下面即可。
|
||||||
|
|
||||||
|
**解决方式**
|
||||||
|
|
||||||
|
可以在`运维管控->集群列表->Topic信息`下面,编辑申请权限的Topic,为Topic选择一个应用即可。
|
||||||
|
|
||||||
|
以上仅仅只是针对单个Topic的场景,如果你有非常多的Topic需要进行初始化的,那么此时可以在配置管理中增加一个配置,来定时的对无主的Topic进行同步,具体见:[动态配置管理 - 1、Topic定时同步任务](../dev_guide/dynamic_config_manager.md)
|
||||||
|
|||||||
32
docs/user_guide/resource_apply.md
Normal file
32
docs/user_guide/resource_apply.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
**一站式`Apache Kafka`集群指标监控与运维管控平台**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
# 资源申请文档
|
||||||
|
|
||||||
|
## 主要名词解释
|
||||||
|
|
||||||
|
- 应用(App):作为Kafka中的账户,使用AppID+password作为身份标识
|
||||||
|
- 集群:可使用平台提供的共享集群,也可为某一应用申请单独的集群
|
||||||
|
- Topic:可申请创建Topic或申请其他Topic的生产/消费权限。进行生产/消费时通过Topic+AppID进行身份鉴权
|
||||||
|

|
||||||
|
|
||||||
|
## 应用申请
|
||||||
|
应用(App)作为Kafka中的账户,使用AppID+password作为身份标识。对Topic进行生产/消费时通过Topic+AppID进行身份鉴权。
|
||||||
|
|
||||||
|
用户申请应用,经由运维人员审批,审批通过后获得AppID和密钥
|
||||||
|
|
||||||
|
## 集群申请
|
||||||
|
可使用平台提供的共享集群,若对隔离性、稳定性、生产消费速率有更高的需求,可对某一应用申请单独的集群
|
||||||
|
|
||||||
|
## Topic申请
|
||||||
|
- 用户可根据已申请的应用创建Topic。创建后,应用负责人默认拥有该Topic的生产/消费权限和管理权限
|
||||||
|
- 也可申请其他Topic的生产、消费权限。经由Topic所属应用的负责人审批后,即可拥有相应权限。
|
||||||
|
|
||||||
|
|
||||||
@@ -5,13 +5,13 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.xiaojukeji.kafka</groupId>
|
<groupId>com.xiaojukeji.kafka</groupId>
|
||||||
<artifactId>kafka-manager-common</artifactId>
|
<artifactId>kafka-manager-common</artifactId>
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
<version>${kafka-manager.revision}</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>kafka-manager</artifactId>
|
<artifactId>kafka-manager</artifactId>
|
||||||
<groupId>com.xiaojukeji.kafka</groupId>
|
<groupId>com.xiaojukeji.kafka</groupId>
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
<version>${kafka-manager.revision}</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@@ -104,5 +104,10 @@
|
|||||||
<groupId>javax.servlet</groupId>
|
<groupId>javax.servlet</groupId>
|
||||||
<artifactId>javax.servlet-api</artifactId>
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
@@ -12,125 +12,97 @@ public enum ResultStatus {
|
|||||||
|
|
||||||
SUCCESS(Constant.SUCCESS, "success"),
|
SUCCESS(Constant.SUCCESS, "success"),
|
||||||
|
|
||||||
LOGIN_FAILED(1, "login failed, please check username and password"),
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 内部依赖错误, [1000, 1200)
|
* 操作错误[1000, 2000)
|
||||||
* ------------------------------------------------------------------------------------------
|
* ------------------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
MYSQL_ERROR(1000, "operate database failed"),
|
|
||||||
|
|
||||||
CONNECT_ZOOKEEPER_FAILED(1000, "connect zookeeper failed"),
|
|
||||||
READ_ZOOKEEPER_FAILED(1000, "read zookeeper failed"),
|
|
||||||
READ_JMX_FAILED(1000, "read jmx failed"),
|
|
||||||
|
|
||||||
|
|
||||||
// 内部依赖错误 —— Kafka特定错误, [1000, 1100)
|
|
||||||
BROKER_NUM_NOT_ENOUGH(1000, "broker not enough"),
|
|
||||||
CONTROLLER_NOT_ALIVE(1000, "controller not alive"),
|
|
||||||
CLUSTER_METADATA_ERROR(1000, "cluster metadata error"),
|
|
||||||
TOPIC_CONFIG_ERROR(1000, "topic config error"),
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 外部依赖错误, [1200, 1400)
|
|
||||||
* ------------------------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
CALL_CLUSTER_TASK_AGENT_FAILED(1000, " call cluster task agent failed"),
|
|
||||||
CALL_MONITOR_SYSTEM_ERROR(1000, " call monitor-system failed"),
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 外部用户操作错误, [1400, 1600)
|
|
||||||
* ------------------------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
PARAM_ILLEGAL(1400, "param illegal"),
|
|
||||||
OPERATION_FAILED(1401, "operation failed"),
|
OPERATION_FAILED(1401, "operation failed"),
|
||||||
OPERATION_FORBIDDEN(1402, "operation forbidden"),
|
OPERATION_FORBIDDEN(1402, "operation forbidden"),
|
||||||
API_CALL_EXCEED_LIMIT(1403, "api call exceed limit"),
|
API_CALL_EXCEED_LIMIT(1403, "api call exceed limit"),
|
||||||
|
USER_WITHOUT_AUTHORITY(1404, "user without authority"),
|
||||||
|
CHANGE_ZOOKEEPER_FORBIDDEN(1405, "change zookeeper forbidden"),
|
||||||
|
|
||||||
// 资源不存在
|
|
||||||
CLUSTER_NOT_EXIST(10000, "cluster not exist"),
|
|
||||||
BROKER_NOT_EXIST(10000, "broker not exist"),
|
|
||||||
TOPIC_NOT_EXIST(10000, "topic not exist"),
|
|
||||||
PARTITION_NOT_EXIST(10000, "partition not exist"),
|
|
||||||
|
|
||||||
ACCOUNT_NOT_EXIST(10000, "account not exist"),
|
TOPIC_OPERATION_PARAM_NULL_POINTER(1450, "参数错误"),
|
||||||
APP_NOT_EXIST(1000, "app not exist"),
|
TOPIC_OPERATION_PARTITION_NUM_ILLEGAL(1451, "分区数错误"),
|
||||||
ORDER_NOT_EXIST(1000, "order not exist"),
|
TOPIC_OPERATION_BROKER_NUM_NOT_ENOUGH(1452, "Broker数不足错误"),
|
||||||
CONFIG_NOT_EXIST(1000, "config not exist"),
|
TOPIC_OPERATION_TOPIC_NAME_ILLEGAL(1453, "Topic名称非法"),
|
||||||
IDC_NOT_EXIST(1000, "idc not exist"),
|
TOPIC_OPERATION_TOPIC_EXISTED(1454, "Topic已存在"),
|
||||||
TASK_NOT_EXIST(1110, "task not exist"),
|
TOPIC_OPERATION_UNKNOWN_TOPIC_PARTITION(1455, "Topic未知"),
|
||||||
|
TOPIC_OPERATION_TOPIC_CONFIG_ILLEGAL(1456, "Topic配置错误"),
|
||||||
|
TOPIC_OPERATION_TOPIC_IN_DELETING(1457, "Topic正在删除"),
|
||||||
|
TOPIC_OPERATION_UNKNOWN_ERROR(1458, "未知错误"),
|
||||||
|
|
||||||
AUTHORITY_NOT_EXIST(1000, "authority not exist"),
|
/**
|
||||||
|
* 参数错误[2000, 3000)
|
||||||
|
* ------------------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
PARAM_ILLEGAL(2000, "param illegal"),
|
||||||
|
CG_LOCATION_ILLEGAL(2001, "consumer group location illegal"),
|
||||||
|
ORDER_ALREADY_HANDLED(2002, "order already handled"),
|
||||||
|
APP_ID_OR_PASSWORD_ILLEGAL(2003, "app or password illegal"),
|
||||||
|
SYSTEM_CODE_ILLEGAL(2004, "system code illegal"),
|
||||||
|
CLUSTER_TASK_HOST_LIST_ILLEGAL(2005, "主机列表错误,请检查主机列表"),
|
||||||
|
JSON_PARSER_ERROR(2006, "json parser error"),
|
||||||
|
|
||||||
MONITOR_NOT_EXIST(1110, "monitor not exist"),
|
BROKER_NUM_NOT_ENOUGH(2050, "broker not enough"),
|
||||||
|
CONTROLLER_NOT_ALIVE(2051, "controller not alive"),
|
||||||
|
CLUSTER_METADATA_ERROR(2052, "cluster metadata error"),
|
||||||
|
TOPIC_CONFIG_ERROR(2053, "topic config error"),
|
||||||
|
|
||||||
QUOTA_NOT_EXIST(1000, "quota not exist, please check clusterId, topicName and appId"),
|
/**
|
||||||
|
* 参数错误 - 资源检查错误
|
||||||
|
* 因为外部系统的问题, 操作时引起的错误, [7000, 8000)
|
||||||
|
* ------------------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
RESOURCE_NOT_EXIST(7100, "资源不存在"),
|
||||||
|
CLUSTER_NOT_EXIST(7101, "cluster not exist"),
|
||||||
|
BROKER_NOT_EXIST(7102, "broker not exist"),
|
||||||
|
TOPIC_NOT_EXIST(7103, "topic not exist"),
|
||||||
|
PARTITION_NOT_EXIST(7104, "partition not exist"),
|
||||||
|
ACCOUNT_NOT_EXIST(7105, "account not exist"),
|
||||||
|
APP_NOT_EXIST(7106, "app not exist"),
|
||||||
|
ORDER_NOT_EXIST(7107, "order not exist"),
|
||||||
|
CONFIG_NOT_EXIST(7108, "config not exist"),
|
||||||
|
IDC_NOT_EXIST(7109, "idc not exist"),
|
||||||
|
TASK_NOT_EXIST(7110, "task not exist"),
|
||||||
|
AUTHORITY_NOT_EXIST(7111, "authority not exist"),
|
||||||
|
MONITOR_NOT_EXIST(7112, "monitor not exist"),
|
||||||
|
QUOTA_NOT_EXIST(7113, "quota not exist, please check clusterId, topicName and appId"),
|
||||||
|
CONSUMER_GROUP_NOT_EXIST(7114, "consumerGroup not exist"),
|
||||||
|
TOPIC_BIZ_DATA_NOT_EXIST(7115, "topic biz data not exist, please sync topic to db"),
|
||||||
|
|
||||||
// 资源不存在, 已存在, 已被使用
|
// 资源已存在
|
||||||
RESOURCE_NOT_EXIST(1200, "资源不存在"),
|
RESOURCE_ALREADY_EXISTED(7200, "资源已经存在"),
|
||||||
RESOURCE_ALREADY_EXISTED(1200, "资源已经存在"),
|
TOPIC_ALREADY_EXIST(7201, "topic already existed"),
|
||||||
RESOURCE_NAME_DUPLICATED(1200, "资源名称重复"),
|
|
||||||
RESOURCE_ALREADY_USED(1000, "资源早已被使用"),
|
// 资源重名
|
||||||
|
RESOURCE_NAME_DUPLICATED(7300, "资源名称重复"),
|
||||||
|
|
||||||
|
// 资源已被使用
|
||||||
|
RESOURCE_ALREADY_USED(7400, "资源早已被使用"),
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资源参数错误
|
* 因为外部系统的问题, 操作时引起的错误, [8000, 9000)
|
||||||
|
* ------------------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
CG_LOCATION_ILLEGAL(10000, "consumer group location illegal"),
|
MYSQL_ERROR(8010, "operate database failed"),
|
||||||
ORDER_ALREADY_HANDLED(1000, "order already handled"),
|
|
||||||
|
|
||||||
APP_ID_OR_PASSWORD_ILLEGAL(1000, "app or password illegal"),
|
ZOOKEEPER_CONNECT_FAILED(8020, "zookeeper connect failed"),
|
||||||
SYSTEM_CODE_ILLEGAL(1000, "system code illegal"),
|
ZOOKEEPER_READ_FAILED(8021, "zookeeper read failed"),
|
||||||
|
|
||||||
CLUSTER_TASK_HOST_LIST_ILLEGAL(1000, "主机列表错误,请检查主机列表"),
|
// 调用集群任务里面的agent失败
|
||||||
|
CALL_CLUSTER_TASK_AGENT_FAILED(8030, " call cluster task agent failed"),
|
||||||
|
|
||||||
|
// 调用监控系统失败
|
||||||
|
CALL_MONITOR_SYSTEM_ERROR(8040, " call monitor-system failed"),
|
||||||
|
|
||||||
|
// 存储相关的调用失败
|
||||||
|
STORAGE_UPLOAD_FILE_FAILED(8050, "upload file failed"),
|
||||||
|
STORAGE_FILE_TYPE_NOT_SUPPORT(8051, "File type not support"),
|
||||||
|
STORAGE_DOWNLOAD_FILE_FAILED(8052, "download file failed"),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
USER_WITHOUT_AUTHORITY(1000, "user without authority"),
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
JSON_PARSER_ERROR(1000, "json parser error"),
|
|
||||||
|
|
||||||
|
|
||||||
TOPIC_OPERATION_PARAM_NULL_POINTER(2, "参数错误"),
|
|
||||||
TOPIC_OPERATION_PARTITION_NUM_ILLEGAL(3, "分区数错误"),
|
|
||||||
TOPIC_OPERATION_BROKER_NUM_NOT_ENOUGH(4, "Broker数不足错误"),
|
|
||||||
TOPIC_OPERATION_TOPIC_NAME_ILLEGAL(5, "Topic名称非法"),
|
|
||||||
TOPIC_OPERATION_TOPIC_EXISTED(6, "Topic已存在"),
|
|
||||||
TOPIC_OPERATION_UNKNOWN_TOPIC_PARTITION(7, "Topic未知"),
|
|
||||||
TOPIC_OPERATION_TOPIC_CONFIG_ILLEGAL(8, "Topic配置错误"),
|
|
||||||
TOPIC_OPERATION_TOPIC_IN_DELETING(9, "Topic正在删除"),
|
|
||||||
TOPIC_OPERATION_UNKNOWN_ERROR(10, "未知错误"),
|
|
||||||
TOPIC_EXIST_CONNECT_CANNOT_DELETE(10, "topic exist connect cannot delete"),
|
|
||||||
EXIST_TOPIC_CANNOT_DELETE(10, "exist topic cannot delete"),
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 工单
|
|
||||||
*/
|
|
||||||
CHANGE_ZOOKEEPER_FORBIDEN(100, "change zookeeper forbiden"),
|
|
||||||
// APP_EXIST_TOPIC_AUTHORITY_CANNOT_DELETE(1000, "app exist topic authority cannot delete"),
|
|
||||||
|
|
||||||
UPLOAD_FILE_FAIL(1000, "upload file fail"),
|
|
||||||
FILE_TYPE_NOT_SUPPORT(1000, "File type not support"),
|
|
||||||
DOWNLOAD_FILE_FAIL(1000, "download file fail"),
|
|
||||||
|
|
||||||
|
|
||||||
TOPIC_ALREADY_EXIST(17400, "topic already existed"),
|
|
||||||
CONSUMER_GROUP_NOT_EXIST(17411, "consumerGroup not exist"),
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private int code;
|
private int code;
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ public class LogicalCluster {
|
|||||||
|
|
||||||
private String logicalClusterName;
|
private String logicalClusterName;
|
||||||
|
|
||||||
|
private String logicalClusterIdentification;
|
||||||
|
|
||||||
private Integer mode;
|
private Integer mode;
|
||||||
|
|
||||||
private Integer topicNum;
|
private Integer topicNum;
|
||||||
@@ -41,6 +43,14 @@ public class LogicalCluster {
|
|||||||
this.logicalClusterName = logicalClusterName;
|
this.logicalClusterName = logicalClusterName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLogicalClusterIdentification() {
|
||||||
|
return logicalClusterIdentification;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLogicalClusterIdentification(String logicalClusterIdentification) {
|
||||||
|
this.logicalClusterIdentification = logicalClusterIdentification;
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getMode() {
|
public Integer getMode() {
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
@@ -81,6 +91,14 @@ public class LogicalCluster {
|
|||||||
this.bootstrapServers = bootstrapServers;
|
this.bootstrapServers = bootstrapServers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
public Long getGmtCreate() {
|
public Long getGmtCreate() {
|
||||||
return gmtCreate;
|
return gmtCreate;
|
||||||
}
|
}
|
||||||
@@ -97,19 +115,12 @@ public class LogicalCluster {
|
|||||||
this.gmtModify = gmtModify;
|
this.gmtModify = gmtModify;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "LogicalCluster{" +
|
return "LogicalCluster{" +
|
||||||
"logicalClusterId=" + logicalClusterId +
|
"logicalClusterId=" + logicalClusterId +
|
||||||
", logicalClusterName='" + logicalClusterName + '\'' +
|
", logicalClusterName='" + logicalClusterName + '\'' +
|
||||||
|
", logicalClusterIdentification='" + logicalClusterIdentification + '\'' +
|
||||||
", mode=" + mode +
|
", mode=" + mode +
|
||||||
", topicNum=" + topicNum +
|
", topicNum=" + topicNum +
|
||||||
", clusterVersion='" + clusterVersion + '\'' +
|
", clusterVersion='" + clusterVersion + '\'' +
|
||||||
|
|||||||
@@ -27,9 +27,12 @@ public class ClusterDTO {
|
|||||||
@ApiModelProperty(value="数据中心")
|
@ApiModelProperty(value="数据中心")
|
||||||
private String idc;
|
private String idc;
|
||||||
|
|
||||||
@ApiModelProperty(value="安全配置参数")
|
@ApiModelProperty(value="Kafka安全配置")
|
||||||
private String securityProperties;
|
private String securityProperties;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="Jmx配置")
|
||||||
|
private String jmxProperties;
|
||||||
|
|
||||||
public Long getClusterId() {
|
public Long getClusterId() {
|
||||||
return clusterId;
|
return clusterId;
|
||||||
}
|
}
|
||||||
@@ -78,6 +81,14 @@ public class ClusterDTO {
|
|||||||
this.securityProperties = securityProperties;
|
this.securityProperties = securityProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getJmxProperties() {
|
||||||
|
return jmxProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJmxProperties(String jmxProperties) {
|
||||||
|
this.jmxProperties = jmxProperties;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ClusterDTO{" +
|
return "ClusterDTO{" +
|
||||||
@@ -87,6 +98,7 @@ public class ClusterDTO {
|
|||||||
", bootstrapServers='" + bootstrapServers + '\'' +
|
", bootstrapServers='" + bootstrapServers + '\'' +
|
||||||
", idc='" + idc + '\'' +
|
", idc='" + idc + '\'' +
|
||||||
", securityProperties='" + securityProperties + '\'' +
|
", securityProperties='" + securityProperties + '\'' +
|
||||||
|
", jmxProperties='" + jmxProperties + '\'' +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ public class LogicalClusterDTO {
|
|||||||
@ApiModelProperty(value = "名称")
|
@ApiModelProperty(value = "名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "集群标识, 用于告警的上报")
|
||||||
|
private String identification;
|
||||||
|
|
||||||
@ApiModelProperty(value = "集群模式")
|
@ApiModelProperty(value = "集群模式")
|
||||||
private Integer mode;
|
private Integer mode;
|
||||||
|
|
||||||
@@ -52,6 +55,14 @@ public class LogicalClusterDTO {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getIdentification() {
|
||||||
|
return identification;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdentification(String identification) {
|
||||||
|
this.identification = identification;
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getMode() {
|
public Integer getMode() {
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
@@ -97,6 +108,7 @@ public class LogicalClusterDTO {
|
|||||||
return "LogicalClusterDTO{" +
|
return "LogicalClusterDTO{" +
|
||||||
"id=" + id +
|
"id=" + id +
|
||||||
", name='" + name + '\'' +
|
", name='" + name + '\'' +
|
||||||
|
", identification='" + identification + '\'' +
|
||||||
", mode=" + mode +
|
", mode=" + mode +
|
||||||
", clusterId=" + clusterId +
|
", clusterId=" + clusterId +
|
||||||
", regionIdList=" + regionIdList +
|
", regionIdList=" + regionIdList +
|
||||||
@@ -117,6 +129,7 @@ public class LogicalClusterDTO {
|
|||||||
}
|
}
|
||||||
appId = ValidateUtils.isNull(appId)? "": appId;
|
appId = ValidateUtils.isNull(appId)? "": appId;
|
||||||
description = ValidateUtils.isNull(description)? "": description;
|
description = ValidateUtils.isNull(description)? "": description;
|
||||||
|
identification = ValidateUtils.isNull(identification)? name: identification;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,8 @@ public class ClusterDO implements Comparable<ClusterDO> {
|
|||||||
|
|
||||||
private String securityProperties;
|
private String securityProperties;
|
||||||
|
|
||||||
|
private String jmxProperties;
|
||||||
|
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
private Date gmtCreate;
|
private Date gmtCreate;
|
||||||
@@ -31,30 +33,6 @@ public class ClusterDO implements Comparable<ClusterDO> {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(Integer status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getGmtCreate() {
|
|
||||||
return gmtCreate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGmtCreate(Date gmtCreate) {
|
|
||||||
this.gmtCreate = gmtCreate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getGmtModify() {
|
|
||||||
return gmtModify;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGmtModify(Date gmtModify) {
|
|
||||||
this.gmtModify = gmtModify;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getClusterName() {
|
public String getClusterName() {
|
||||||
return clusterName;
|
return clusterName;
|
||||||
}
|
}
|
||||||
@@ -87,6 +65,38 @@ public class ClusterDO implements Comparable<ClusterDO> {
|
|||||||
this.securityProperties = securityProperties;
|
this.securityProperties = securityProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getJmxProperties() {
|
||||||
|
return jmxProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJmxProperties(String jmxProperties) {
|
||||||
|
this.jmxProperties = jmxProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(Integer status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getGmtCreate() {
|
||||||
|
return gmtCreate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGmtCreate(Date gmtCreate) {
|
||||||
|
this.gmtCreate = gmtCreate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getGmtModify() {
|
||||||
|
return gmtModify;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGmtModify(Date gmtModify) {
|
||||||
|
this.gmtModify = gmtModify;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ClusterDO{" +
|
return "ClusterDO{" +
|
||||||
@@ -95,6 +105,7 @@ public class ClusterDO implements Comparable<ClusterDO> {
|
|||||||
", zookeeper='" + zookeeper + '\'' +
|
", zookeeper='" + zookeeper + '\'' +
|
||||||
", bootstrapServers='" + bootstrapServers + '\'' +
|
", bootstrapServers='" + bootstrapServers + '\'' +
|
||||||
", securityProperties='" + securityProperties + '\'' +
|
", securityProperties='" + securityProperties + '\'' +
|
||||||
|
", jmxProperties='" + jmxProperties + '\'' +
|
||||||
", status=" + status +
|
", status=" + status +
|
||||||
", gmtCreate=" + gmtCreate +
|
", gmtCreate=" + gmtCreate +
|
||||||
", gmtModify=" + gmtModify +
|
", gmtModify=" + gmtModify +
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ public class LogicalClusterDO {
|
|||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
private String identification;
|
||||||
|
|
||||||
private Integer mode;
|
private Integer mode;
|
||||||
|
|
||||||
private String appId;
|
private String appId;
|
||||||
@@ -41,6 +43,14 @@ public class LogicalClusterDO {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getIdentification() {
|
||||||
|
return identification;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdentification(String identification) {
|
||||||
|
this.identification = identification;
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getMode() {
|
public Integer getMode() {
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
@@ -102,6 +112,7 @@ public class LogicalClusterDO {
|
|||||||
return "LogicalClusterDO{" +
|
return "LogicalClusterDO{" +
|
||||||
"id=" + id +
|
"id=" + id +
|
||||||
", name='" + name + '\'' +
|
", name='" + name + '\'' +
|
||||||
|
", identification='" + identification + '\'' +
|
||||||
", mode=" + mode +
|
", mode=" + mode +
|
||||||
", appId='" + appId + '\'' +
|
", appId='" + appId + '\'' +
|
||||||
", clusterId=" + clusterId +
|
", clusterId=" + clusterId +
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ public class LogicClusterVO {
|
|||||||
@ApiModelProperty(value="逻辑集群名称")
|
@ApiModelProperty(value="逻辑集群名称")
|
||||||
private String clusterName;
|
private String clusterName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="逻辑标识")
|
||||||
|
private String clusterIdentification;
|
||||||
|
|
||||||
@ApiModelProperty(value="逻辑集群类型, 0:共享集群, 1:独享集群, 2:独立集群")
|
@ApiModelProperty(value="逻辑集群类型, 0:共享集群, 1:独享集群, 2:独立集群")
|
||||||
private Integer mode;
|
private Integer mode;
|
||||||
|
|
||||||
@@ -24,9 +27,6 @@ public class LogicClusterVO {
|
|||||||
@ApiModelProperty(value="集群版本")
|
@ApiModelProperty(value="集群版本")
|
||||||
private String clusterVersion;
|
private String clusterVersion;
|
||||||
|
|
||||||
@ApiModelProperty(value="物理集群ID")
|
|
||||||
private Long physicalClusterId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value="集群服务地址")
|
@ApiModelProperty(value="集群服务地址")
|
||||||
private String bootstrapServers;
|
private String bootstrapServers;
|
||||||
|
|
||||||
@@ -55,6 +55,22 @@ public class LogicClusterVO {
|
|||||||
this.clusterName = clusterName;
|
this.clusterName = clusterName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getClusterIdentification() {
|
||||||
|
return clusterIdentification;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClusterIdentification(String clusterIdentification) {
|
||||||
|
this.clusterIdentification = clusterIdentification;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMode() {
|
||||||
|
return mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMode(Integer mode) {
|
||||||
|
this.mode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getTopicNum() {
|
public Integer getTopicNum() {
|
||||||
return topicNum;
|
return topicNum;
|
||||||
}
|
}
|
||||||
@@ -71,14 +87,6 @@ public class LogicClusterVO {
|
|||||||
this.clusterVersion = clusterVersion;
|
this.clusterVersion = clusterVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getPhysicalClusterId() {
|
|
||||||
return physicalClusterId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPhysicalClusterId(Long physicalClusterId) {
|
|
||||||
this.physicalClusterId = physicalClusterId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBootstrapServers() {
|
public String getBootstrapServers() {
|
||||||
return bootstrapServers;
|
return bootstrapServers;
|
||||||
}
|
}
|
||||||
@@ -87,6 +95,14 @@ public class LogicClusterVO {
|
|||||||
this.bootstrapServers = bootstrapServers;
|
this.bootstrapServers = bootstrapServers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
public Long getGmtCreate() {
|
public Long getGmtCreate() {
|
||||||
return gmtCreate;
|
return gmtCreate;
|
||||||
}
|
}
|
||||||
@@ -103,32 +119,15 @@ public class LogicClusterVO {
|
|||||||
this.gmtModify = gmtModify;
|
this.gmtModify = gmtModify;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getMode() {
|
|
||||||
return mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMode(Integer mode) {
|
|
||||||
this.mode = mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "LogicClusterVO{" +
|
return "LogicClusterVO{" +
|
||||||
"clusterId=" + clusterId +
|
"clusterId=" + clusterId +
|
||||||
", clusterName='" + clusterName + '\'' +
|
", clusterName='" + clusterName + '\'' +
|
||||||
|
", clusterIdentification='" + clusterIdentification + '\'' +
|
||||||
", mode=" + mode +
|
", mode=" + mode +
|
||||||
", topicNum=" + topicNum +
|
", topicNum=" + topicNum +
|
||||||
", clusterVersion='" + clusterVersion + '\'' +
|
", clusterVersion='" + clusterVersion + '\'' +
|
||||||
", physicalClusterId=" + physicalClusterId +
|
|
||||||
", bootstrapServers='" + bootstrapServers + '\'' +
|
", bootstrapServers='" + bootstrapServers + '\'' +
|
||||||
", description='" + description + '\'' +
|
", description='" + description + '\'' +
|
||||||
", gmtCreate=" + gmtCreate +
|
", gmtCreate=" + gmtCreate +
|
||||||
|
|||||||
@@ -32,9 +32,12 @@ public class ClusterBaseVO {
|
|||||||
@ApiModelProperty(value="集群类型")
|
@ApiModelProperty(value="集群类型")
|
||||||
private Integer mode;
|
private Integer mode;
|
||||||
|
|
||||||
@ApiModelProperty(value="安全配置参数")
|
@ApiModelProperty(value="Kafka安全配置")
|
||||||
private String securityProperties;
|
private String securityProperties;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="Jmx配置")
|
||||||
|
private String jmxProperties;
|
||||||
|
|
||||||
@ApiModelProperty(value="1:监控中, 0:暂停监控")
|
@ApiModelProperty(value="1:监控中, 0:暂停监控")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@@ -108,6 +111,14 @@ public class ClusterBaseVO {
|
|||||||
this.securityProperties = securityProperties;
|
this.securityProperties = securityProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getJmxProperties() {
|
||||||
|
return jmxProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJmxProperties(String jmxProperties) {
|
||||||
|
this.jmxProperties = jmxProperties;
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getStatus() {
|
public Integer getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -141,8 +152,9 @@ public class ClusterBaseVO {
|
|||||||
", bootstrapServers='" + bootstrapServers + '\'' +
|
", bootstrapServers='" + bootstrapServers + '\'' +
|
||||||
", kafkaVersion='" + kafkaVersion + '\'' +
|
", kafkaVersion='" + kafkaVersion + '\'' +
|
||||||
", idc='" + idc + '\'' +
|
", idc='" + idc + '\'' +
|
||||||
", mode='" + mode + '\'' +
|
", mode=" + mode +
|
||||||
", securityProperties='" + securityProperties + '\'' +
|
", securityProperties='" + securityProperties + '\'' +
|
||||||
|
", jmxProperties='" + jmxProperties + '\'' +
|
||||||
", status=" + status +
|
", status=" + status +
|
||||||
", gmtCreate=" + gmtCreate +
|
", gmtCreate=" + gmtCreate +
|
||||||
", gmtModify=" + gmtModify +
|
", gmtModify=" + gmtModify +
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ public class LogicalClusterVO {
|
|||||||
@ApiModelProperty(value = "逻辑集群名称")
|
@ApiModelProperty(value = "逻辑集群名称")
|
||||||
private String logicalClusterName;
|
private String logicalClusterName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "逻辑集群标识")
|
||||||
|
private String logicalClusterIdentification;
|
||||||
|
|
||||||
@ApiModelProperty(value = "物理集群ID")
|
@ApiModelProperty(value = "物理集群ID")
|
||||||
private Long physicalClusterId;
|
private Long physicalClusterId;
|
||||||
|
|
||||||
@@ -55,6 +58,14 @@ public class LogicalClusterVO {
|
|||||||
this.logicalClusterName = logicalClusterName;
|
this.logicalClusterName = logicalClusterName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLogicalClusterIdentification() {
|
||||||
|
return logicalClusterIdentification;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLogicalClusterIdentification(String logicalClusterIdentification) {
|
||||||
|
this.logicalClusterIdentification = logicalClusterIdentification;
|
||||||
|
}
|
||||||
|
|
||||||
public Long getPhysicalClusterId() {
|
public Long getPhysicalClusterId() {
|
||||||
return physicalClusterId;
|
return physicalClusterId;
|
||||||
}
|
}
|
||||||
@@ -116,6 +127,7 @@ public class LogicalClusterVO {
|
|||||||
return "LogicalClusterVO{" +
|
return "LogicalClusterVO{" +
|
||||||
"logicalClusterId=" + logicalClusterId +
|
"logicalClusterId=" + logicalClusterId +
|
||||||
", logicalClusterName='" + logicalClusterName + '\'' +
|
", logicalClusterName='" + logicalClusterName + '\'' +
|
||||||
|
", logicalClusterIdentification='" + logicalClusterIdentification + '\'' +
|
||||||
", physicalClusterId=" + physicalClusterId +
|
", physicalClusterId=" + physicalClusterId +
|
||||||
", regionIdList=" + regionIdList +
|
", regionIdList=" + regionIdList +
|
||||||
", mode=" + mode +
|
", mode=" + mode +
|
||||||
|
|||||||
@@ -53,6 +53,13 @@ public class JsonUtils {
|
|||||||
return JSON.toJSONString(obj);
|
return JSON.toJSONString(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> T stringToObj(String src, Class<T> clazz) {
|
||||||
|
if (ValidateUtils.isBlank(src)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return JSON.parseObject(src, clazz);
|
||||||
|
}
|
||||||
|
|
||||||
public static List<TopicConnectionDO> parseTopicConnections(Long clusterId, JSONObject jsonObject, long postTime) {
|
public static List<TopicConnectionDO> parseTopicConnections(Long clusterId, JSONObject jsonObject, long postTime) {
|
||||||
List<TopicConnectionDO> connectionDOList = new ArrayList<>();
|
List<TopicConnectionDO> connectionDOList = new ArrayList<>();
|
||||||
for (String clientType: jsonObject.keySet()) {
|
for (String clientType: jsonObject.keySet()) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.xiaojukeji.kafka.manager.common.utils;
|
|||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -11,6 +12,20 @@ import java.util.Set;
|
|||||||
* @date 20/4/16
|
* @date 20/4/16
|
||||||
*/
|
*/
|
||||||
public class ValidateUtils {
|
public class ValidateUtils {
|
||||||
|
/**
|
||||||
|
* 任意一个为空, 则返回true
|
||||||
|
*/
|
||||||
|
public static boolean anyNull(Object... objects) {
|
||||||
|
return Arrays.stream(objects).anyMatch(ValidateUtils::isNull);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是空字符串或者空
|
||||||
|
*/
|
||||||
|
public static boolean anyBlank(String... strings) {
|
||||||
|
return Arrays.stream(strings).anyMatch(StringUtils::isBlank);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 为空
|
* 为空
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package com.xiaojukeji.kafka.manager.common.utils.jmx;
|
||||||
|
|
||||||
|
public class JmxConfig {
|
||||||
|
/**
|
||||||
|
* 单台最大连接数
|
||||||
|
*/
|
||||||
|
private Integer maxConn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启SSL
|
||||||
|
*/
|
||||||
|
private Boolean openSSL;
|
||||||
|
|
||||||
|
public Integer getMaxConn() {
|
||||||
|
return maxConn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxConn(Integer maxConn) {
|
||||||
|
this.maxConn = maxConn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isOpenSSL() {
|
||||||
|
return openSSL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenSSL(Boolean openSSL) {
|
||||||
|
this.openSSL = openSSL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "JmxConfig{" +
|
||||||
|
"maxConn=" + maxConn +
|
||||||
|
", username='" + username + '\'' +
|
||||||
|
", password='" + password + '\'' +
|
||||||
|
", openSSL=" + openSSL +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.xiaojukeji.kafka.manager.common.utils.jmx;
|
package com.xiaojukeji.kafka.manager.common.utils.jmx;
|
||||||
|
|
||||||
|
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -7,8 +8,14 @@ import javax.management.*;
|
|||||||
import javax.management.remote.JMXConnector;
|
import javax.management.remote.JMXConnector;
|
||||||
import javax.management.remote.JMXConnectorFactory;
|
import javax.management.remote.JMXConnectorFactory;
|
||||||
import javax.management.remote.JMXServiceURL;
|
import javax.management.remote.JMXServiceURL;
|
||||||
|
import javax.management.remote.rmi.RMIConnectorServer;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.rmi.ssl.SslRMIClientSocketFactory;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
@@ -28,13 +35,19 @@ public class JmxConnectorWrap {
|
|||||||
|
|
||||||
private AtomicInteger atomicInteger;
|
private AtomicInteger atomicInteger;
|
||||||
|
|
||||||
public JmxConnectorWrap(String host, int port, int maxConn) {
|
private JmxConfig jmxConfig;
|
||||||
|
|
||||||
|
public JmxConnectorWrap(String host, int port, JmxConfig jmxConfig) {
|
||||||
this.host = host;
|
this.host = host;
|
||||||
this.port = port;
|
this.port = port;
|
||||||
if (maxConn <= 0) {
|
this.jmxConfig = jmxConfig;
|
||||||
maxConn = 1;
|
if (ValidateUtils.isNull(this.jmxConfig)) {
|
||||||
|
this.jmxConfig = new JmxConfig();
|
||||||
}
|
}
|
||||||
this.atomicInteger = new AtomicInteger(maxConn);
|
if (ValidateUtils.isNullOrLessThanZero(this.jmxConfig.getMaxConn())) {
|
||||||
|
this.jmxConfig.setMaxConn(1);
|
||||||
|
}
|
||||||
|
this.atomicInteger = new AtomicInteger(this.jmxConfig.getMaxConn());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkJmxConnectionAndInitIfNeed() {
|
public boolean checkJmxConnectionAndInitIfNeed() {
|
||||||
@@ -64,8 +77,18 @@ public class JmxConnectorWrap {
|
|||||||
}
|
}
|
||||||
String jmxUrl = String.format("service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi", host, port);
|
String jmxUrl = String.format("service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi", host, port);
|
||||||
try {
|
try {
|
||||||
JMXServiceURL url = new JMXServiceURL(jmxUrl);
|
Map<String, Object> environment = new HashMap<String, Object>();
|
||||||
jmxConnector = JMXConnectorFactory.connect(url, null);
|
if (!ValidateUtils.isBlank(this.jmxConfig.getUsername()) && !ValidateUtils.isBlank(this.jmxConfig.getPassword())) {
|
||||||
|
environment.put(javax.management.remote.JMXConnector.CREDENTIALS, Arrays.asList(this.jmxConfig.getUsername(), this.jmxConfig.getPassword()));
|
||||||
|
}
|
||||||
|
if (jmxConfig.isOpenSSL() != null && this.jmxConfig.isOpenSSL()) {
|
||||||
|
environment.put(Context.SECURITY_PROTOCOL, "ssl");
|
||||||
|
SslRMIClientSocketFactory clientSocketFactory = new SslRMIClientSocketFactory();
|
||||||
|
environment.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, clientSocketFactory);
|
||||||
|
environment.put("com.sun.jndi.rmi.factory.socket", clientSocketFactory);
|
||||||
|
}
|
||||||
|
|
||||||
|
jmxConnector = JMXConnectorFactory.connect(new JMXServiceURL(jmxUrl), environment);
|
||||||
LOGGER.info("JMX connect success, host:{} port:{}.", host, port);
|
LOGGER.info("JMX connect success, host:{} port:{}.", host, port);
|
||||||
return true;
|
return true;
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.xiaojukeji.kafka.manager.common.utils;
|
||||||
|
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class JsonUtilsTest {
|
||||||
|
@Test
|
||||||
|
public void testMapToJsonString() {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("key", "value");
|
||||||
|
map.put("int", 1);
|
||||||
|
String expectRes = "{\"key\":\"value\",\"int\":1}";
|
||||||
|
Assert.assertEquals(expectRes, JsonUtils.toJSONString(map));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>kafka-manager</artifactId>
|
<artifactId>kafka-manager</artifactId>
|
||||||
<groupId>com.xiaojukeji.kafka</groupId>
|
<groupId>com.xiaojukeji.kafka</groupId>
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
<version>${kafka-manager.revision}</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|||||||
import { Select, Input, InputNumber, Form, Switch, Checkbox, DatePicker, Radio, Upload, Button, Icon, Tooltip } from 'component/antd';
|
import { Select, Input, InputNumber, Form, Switch, Checkbox, DatePicker, Radio, Upload, Button, Icon, Tooltip } from 'component/antd';
|
||||||
import Monacoeditor from 'component/editor/monacoEditor';
|
import Monacoeditor from 'component/editor/monacoEditor';
|
||||||
import { searchProps } from 'constants/table';
|
import { searchProps } from 'constants/table';
|
||||||
|
import { version } from 'store/version';
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
|
||||||
const TextArea = Input.TextArea;
|
const TextArea = Input.TextArea;
|
||||||
@@ -189,7 +190,7 @@ class XForm extends React.Component<IXFormProps> {
|
|||||||
case FormItemType.upload:
|
case FormItemType.upload:
|
||||||
return (
|
return (
|
||||||
<Upload beforeUpload={(file: any) => false} {...item.attrs}>
|
<Upload beforeUpload={(file: any) => false} {...item.attrs}>
|
||||||
<Button><Icon type="upload" />上传</Button>
|
<Button><Icon type="upload" />上传</Button>{version.fileSuffix && <span style={{ color: '#fb3939', padding: '0 0 0 10px' }}>{`请上传${version.fileSuffix}文件`}</span>}
|
||||||
</Upload>
|
</Upload>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export const cellStyle = {
|
|||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
whiteSpace: 'nowrap',
|
whiteSpace: 'nowrap',
|
||||||
textOverflow: 'ellipsis',
|
textOverflow: 'ellipsis',
|
||||||
cursor: 'pointer',
|
// cursor: 'pointer',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const searchProps = {
|
export const searchProps = {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export class ClusterConsumer extends SearchAndFilterContainer {
|
|||||||
key: 'operation',
|
key: 'operation',
|
||||||
width: '10%',
|
width: '10%',
|
||||||
render: (t: string, item: IOffset) => {
|
render: (t: string, item: IOffset) => {
|
||||||
return (<a onClick={() => this.getConsumeDetails(item)}>详情</a>);
|
return (<a onClick={() => this.getConsumeDetails(item)}>消费详情</a>);
|
||||||
},
|
},
|
||||||
}];
|
}];
|
||||||
private xFormModal: IXFormWrapper;
|
private xFormModal: IXFormWrapper;
|
||||||
@@ -110,7 +110,7 @@ export class ClusterConsumer extends SearchAndFilterContainer {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Modal
|
<Modal
|
||||||
title="消费的Topic"
|
title="消费详情"
|
||||||
visible={this.state.detailsVisible}
|
visible={this.state.detailsVisible}
|
||||||
onOk={() => this.handleDetailsOk()}
|
onOk={() => this.handleDetailsOk()}
|
||||||
onCancel={() => this.handleDetailsCancel()}
|
onCancel={() => this.handleDetailsCancel()}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|||||||
import Url from 'lib/url-parser';
|
import Url from 'lib/url-parser';
|
||||||
import { region } from 'store';
|
import { region } from 'store';
|
||||||
import { admin } from 'store/admin';
|
import { admin } from 'store/admin';
|
||||||
import { topic } from 'store/topic';
|
import { app } from 'store/app';
|
||||||
import { Table, notification, Tooltip, Popconfirm } from 'antd';
|
import { Table, notification, Tooltip, Popconfirm } from 'antd';
|
||||||
import { pagination, cellStyle } from 'constants/table';
|
import { pagination, cellStyle } from 'constants/table';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
@@ -56,8 +56,6 @@ export class ClusterTopic extends SearchAndFilterContainer {
|
|||||||
public expandPartition(item: IClusterTopics) {
|
public expandPartition(item: IClusterTopics) {
|
||||||
// getTopicBasicInfo
|
// getTopicBasicInfo
|
||||||
admin.getTopicsBasicInfo(item.clusterId, item.topicName).then(data => {
|
admin.getTopicsBasicInfo(item.clusterId, item.topicName).then(data => {
|
||||||
console.log(admin.topicsBasic);
|
|
||||||
console.log(admin.basicInfo);
|
|
||||||
this.clusterTopicsFrom = item;
|
this.clusterTopicsFrom = item;
|
||||||
this.setState({
|
this.setState({
|
||||||
expandVisible: true,
|
expandVisible: true,
|
||||||
@@ -114,6 +112,7 @@ export class ClusterTopic extends SearchAndFilterContainer {
|
|||||||
|
|
||||||
public componentDidMount() {
|
public componentDidMount() {
|
||||||
admin.getClusterTopics(this.clusterId);
|
admin.getClusterTopics(this.clusterId);
|
||||||
|
app.getAdminAppList()
|
||||||
}
|
}
|
||||||
|
|
||||||
public renderClusterTopicList() {
|
public renderClusterTopicList() {
|
||||||
|
|||||||
@@ -159,7 +159,6 @@ export class ExclusiveCluster extends SearchAndFilterContainer {
|
|||||||
|
|
||||||
public handleDeleteRegion = (record: IBrokersRegions) => {
|
public handleDeleteRegion = (record: IBrokersRegions) => {
|
||||||
const filterRegion = admin.logicalClusters.filter(item => item.regionIdList.includes(record.id));
|
const filterRegion = admin.logicalClusters.filter(item => item.regionIdList.includes(record.id));
|
||||||
|
|
||||||
if (!filterRegion) {
|
if (!filterRegion) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -335,6 +334,7 @@ export class ExclusiveCluster extends SearchAndFilterContainer {
|
|||||||
{this.renderSearch('', '请输入Region名称/broker ID')}
|
{this.renderSearch('', '请输入Region名称/broker ID')}
|
||||||
</ul>
|
</ul>
|
||||||
{this.renderRegion()}
|
{this.renderRegion()}
|
||||||
|
{this.renderDeleteRegionModal()}
|
||||||
</div >
|
</div >
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,15 +40,15 @@ export class LogicalCluster extends SearchAndFilterContainer {
|
|||||||
key: 'logicalClusterId',
|
key: 'logicalClusterId',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '逻辑集群中文名称',
|
title: '逻辑集群名称',
|
||||||
dataIndex: 'logicalClusterName',
|
dataIndex: 'logicalClusterName',
|
||||||
key: 'logicalClusterName',
|
key: 'logicalClusterName',
|
||||||
width: '150px'
|
width: '150px'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '逻辑集群英文名称',
|
title: '逻辑集群标识',
|
||||||
dataIndex: 'logicalClusterName',
|
dataIndex: 'logicalClusterIdentification',
|
||||||
key: 'logicalClusterName1',
|
key: 'logicalClusterIdentification',
|
||||||
width: '150px'
|
width: '150px'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Modal, Table, Button, notification, message, Tooltip, Icon, Popconfirm, Alert } from 'component/antd';
|
import { Modal, Table, Button, notification, message, Tooltip, Icon, Popconfirm, Alert, Popover } from 'component/antd';
|
||||||
import { wrapper } from 'store';
|
import { wrapper } from 'store';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import { IXFormWrapper, IMetaData, IRegister } from 'types/base-type';
|
import { IXFormWrapper, IMetaData, IRegister } from 'types/base-type';
|
||||||
@@ -58,7 +58,7 @@ export class ClusterList extends SearchAndFilterContainer {
|
|||||||
message: '请输入zookeeper地址',
|
message: '请输入zookeeper地址',
|
||||||
}],
|
}],
|
||||||
attrs: {
|
attrs: {
|
||||||
placeholder: '请输入zookeeper地址',
|
placeholder: '请输入zookeeper地址,例如:192.168.0.1:2181,192.168.0.2:2181/logi-kafka',
|
||||||
rows: 2,
|
rows: 2,
|
||||||
disabled: item ? true : false,
|
disabled: item ? true : false,
|
||||||
},
|
},
|
||||||
@@ -72,7 +72,7 @@ export class ClusterList extends SearchAndFilterContainer {
|
|||||||
message: '请输入bootstrapServers',
|
message: '请输入bootstrapServers',
|
||||||
}],
|
}],
|
||||||
attrs: {
|
attrs: {
|
||||||
placeholder: '请输入bootstrapServers',
|
placeholder: '请输入bootstrapServers,例如:192.168.1.1:9092,192.168.1.2:9092',
|
||||||
rows: 2,
|
rows: 2,
|
||||||
disabled: item ? true : false,
|
disabled: item ? true : false,
|
||||||
},
|
},
|
||||||
@@ -131,7 +131,7 @@ export class ClusterList extends SearchAndFilterContainer {
|
|||||||
{
|
{
|
||||||
"security.protocol": "SASL_PLAINTEXT",
|
"security.protocol": "SASL_PLAINTEXT",
|
||||||
"sasl.mechanism": "PLAIN",
|
"sasl.mechanism": "PLAIN",
|
||||||
"sasl.jaas.config": "org.apache.kafka.common.security.plain.PlainLoginModule required username=\"xxxxxx\" password=\"xxxxxx\";"
|
"sasl.jaas.config": "org.apache.kafka.common.security.plain.PlainLoginModule required username=\\"xxxxxx\\" password=\\"xxxxxx\\";"
|
||||||
}`,
|
}`,
|
||||||
rows: 8,
|
rows: 8,
|
||||||
},
|
},
|
||||||
@@ -271,11 +271,13 @@ export class ClusterList extends SearchAndFilterContainer {
|
|||||||
cancelText="取消"
|
cancelText="取消"
|
||||||
okText="确认"
|
okText="确认"
|
||||||
>
|
>
|
||||||
<a
|
<Tooltip title="暂停监控将无法正常监控指标信息,建议开启监控">
|
||||||
className="action-button"
|
<a
|
||||||
>
|
className="action-button"
|
||||||
{item.status === 1 ? '暂停监控' : '开始监控'}
|
>
|
||||||
</a>
|
{item.status === 1 ? '暂停监控' : '开始监控'}
|
||||||
|
</a>
|
||||||
|
</Tooltip>
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
<a onClick={this.showMonitor.bind(this, item)}>
|
<a onClick={this.showMonitor.bind(this, item)}>
|
||||||
删除
|
删除
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ export class IndividualBill extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public renderTableList() {
|
public renderTableList() {
|
||||||
const adminUrl=`${urlPrefix}/admin/bill-detail`
|
const adminUrl = `${urlPrefix}/admin/bill-detail`
|
||||||
return (
|
return (
|
||||||
<Table
|
<Table
|
||||||
rowKey="key"
|
rowKey="key"
|
||||||
@@ -93,7 +93,7 @@ export class IndividualBill extends React.Component {
|
|||||||
public renderChart() {
|
public renderChart() {
|
||||||
return (
|
return (
|
||||||
<div className="chart-box">
|
<div className="chart-box">
|
||||||
<BarChartComponet ref={(ref) => this.chart = ref } getChartData={this.getData.bind(this, null)} />
|
<BarChartComponet ref={(ref) => this.chart = ref} getChartData={this.getData.bind(this, null)} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { filterKeys } from 'constants/strategy';
|
|||||||
import { VirtualScrollSelect } from 'component/virtual-scroll-select';
|
import { VirtualScrollSelect } from 'component/virtual-scroll-select';
|
||||||
import { IsNotNaN } from 'lib/utils';
|
import { IsNotNaN } from 'lib/utils';
|
||||||
import { searchProps } from 'constants/table';
|
import { searchProps } from 'constants/table';
|
||||||
|
import { toJS } from 'mobx';
|
||||||
|
|
||||||
interface IDynamicProps {
|
interface IDynamicProps {
|
||||||
form?: any;
|
form?: any;
|
||||||
@@ -33,6 +34,7 @@ export class DynamicSetFilter extends React.Component<IDynamicProps> {
|
|||||||
public monitorType: string = null;
|
public monitorType: string = null;
|
||||||
public clusterId: number = null;
|
public clusterId: number = null;
|
||||||
public clusterName: string = null;
|
public clusterName: string = null;
|
||||||
|
public clusterIdentification: string | number = null;
|
||||||
public topicName: string = null;
|
public topicName: string = null;
|
||||||
public consumerGroup: string = null;
|
public consumerGroup: string = null;
|
||||||
public location: string = null;
|
public location: string = null;
|
||||||
@@ -45,16 +47,18 @@ export class DynamicSetFilter extends React.Component<IDynamicProps> {
|
|||||||
this.props.form.validateFields((err: Error, values: any) => {
|
this.props.form.validateFields((err: Error, values: any) => {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
monitorType = values.monitorType;
|
monitorType = values.monitorType;
|
||||||
const index = cluster.clusterData.findIndex(item => item.clusterId === values.cluster);
|
const index = cluster.clusterData.findIndex(item => item.clusterIdentification === values.cluster);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
|
values.clusterIdentification = cluster.clusterData[index].clusterIdentification;
|
||||||
values.clusterName = cluster.clusterData[index].clusterName;
|
values.clusterName = cluster.clusterData[index].clusterName;
|
||||||
}
|
}
|
||||||
for (const key of Object.keys(values)) {
|
for (const key of Object.keys(values)) {
|
||||||
if (filterKeys.indexOf(key) > -1) { // 只有这几种值可以设置
|
if (filterKeys.indexOf(key) > -1) { // 只有这几种值可以设置
|
||||||
filterList.push({
|
filterList.push({
|
||||||
tkey: key === 'clusterName' ? 'cluster' : key, // 传参需要将clusterName转成cluster
|
tkey: key === 'clusterName' ? 'cluster' : key, // clusterIdentification
|
||||||
topt: '=',
|
topt: '=',
|
||||||
tval: [values[key]],
|
tval: [values[key]],
|
||||||
|
clusterIdentification: values.clusterIdentification
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -74,13 +78,13 @@ export class DynamicSetFilter extends React.Component<IDynamicProps> {
|
|||||||
|
|
||||||
public resetFormValue(
|
public resetFormValue(
|
||||||
monitorType: string = null,
|
monitorType: string = null,
|
||||||
clusterId: number = null,
|
clusterIdentification: any = null,
|
||||||
topicName: string = null,
|
topicName: string = null,
|
||||||
consumerGroup: string = null,
|
consumerGroup: string = null,
|
||||||
location: string = null) {
|
location: string = null) {
|
||||||
const { setFieldsValue } = this.props.form;
|
const { setFieldsValue } = this.props.form;
|
||||||
setFieldsValue({
|
setFieldsValue({
|
||||||
cluster: clusterId,
|
cluster: clusterIdentification,
|
||||||
topic: topicName,
|
topic: topicName,
|
||||||
consumerGroup,
|
consumerGroup,
|
||||||
location,
|
location,
|
||||||
@@ -88,18 +92,18 @@ export class DynamicSetFilter extends React.Component<IDynamicProps> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public getClusterId = (clusterName: string) => {
|
public getClusterId = async (clusterIdentification: any) => {
|
||||||
let clusterId = null;
|
let clusterId = null;
|
||||||
const index = cluster.clusterData.findIndex(item => item.clusterName === clusterName);
|
const index = cluster.clusterData.findIndex(item => item.clusterIdentification === clusterIdentification);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
clusterId = cluster.clusterData[index].clusterId;
|
clusterId = cluster.clusterData[index].clusterId;
|
||||||
}
|
}
|
||||||
if (clusterId) {
|
if (clusterId) {
|
||||||
cluster.getClusterMetaTopics(clusterId);
|
await cluster.getClusterMetaTopics(clusterId);
|
||||||
this.clusterId = clusterId;
|
this.clusterId = clusterId;
|
||||||
return this.clusterId;
|
return this.clusterId;
|
||||||
}
|
};
|
||||||
return this.clusterId = clusterName as any;
|
return this.clusterId = clusterId as any;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async initFormValue(monitorRule: IRequestParams) {
|
public async initFormValue(monitorRule: IRequestParams) {
|
||||||
@@ -108,17 +112,19 @@ export class DynamicSetFilter extends React.Component<IDynamicProps> {
|
|||||||
const topicFilter = strategyFilterList.filter(item => item.tkey === 'topic')[0];
|
const topicFilter = strategyFilterList.filter(item => item.tkey === 'topic')[0];
|
||||||
const consumerFilter = strategyFilterList.filter(item => item.tkey === 'consumerGroup')[0];
|
const consumerFilter = strategyFilterList.filter(item => item.tkey === 'consumerGroup')[0];
|
||||||
|
|
||||||
const clusterName = clusterFilter ? clusterFilter.tval[0] : null;
|
const clusterIdentification = clusterFilter ? clusterFilter.tval[0] : null;
|
||||||
const topic = topicFilter ? topicFilter.tval[0] : null;
|
const topic = topicFilter ? topicFilter.tval[0] : null;
|
||||||
const consumerGroup = consumerFilter ? consumerFilter.tval[0] : null;
|
const consumerGroup = consumerFilter ? consumerFilter.tval[0] : null;
|
||||||
const location: string = null;
|
const location: string = null;
|
||||||
const monitorType = monitorRule.strategyExpressionList[0].metric;
|
const monitorType = monitorRule.strategyExpressionList[0].metric;
|
||||||
alarm.changeMonitorStrategyType(monitorType);
|
alarm.changeMonitorStrategyType(monitorType);
|
||||||
|
//增加clusterIdentification替代原来的clusterName
|
||||||
await this.getClusterId(clusterName);
|
this.clusterIdentification = clusterIdentification;
|
||||||
|
await this.getClusterId(this.clusterIdentification);
|
||||||
|
//
|
||||||
await this.handleSelectChange(topic, 'topic');
|
await this.handleSelectChange(topic, 'topic');
|
||||||
await this.handleSelectChange(consumerGroup, 'consumerGroup');
|
await this.handleSelectChange(consumerGroup, 'consumerGroup');
|
||||||
this.resetFormValue(monitorType, this.clusterId, topic, consumerGroup, location);
|
this.resetFormValue(monitorType, this.clusterIdentification, topic, consumerGroup, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
public clearFormData() {
|
public clearFormData() {
|
||||||
@@ -130,11 +136,12 @@ export class DynamicSetFilter extends React.Component<IDynamicProps> {
|
|||||||
this.resetFormValue();
|
this.resetFormValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async handleClusterChange(e: number) {
|
public async handleClusterChange(e: any) {
|
||||||
this.clusterId = e;
|
this.clusterIdentification = e;
|
||||||
this.topicName = null;
|
this.topicName = null;
|
||||||
topic.setLoading(true);
|
topic.setLoading(true);
|
||||||
await cluster.getClusterMetaTopics(e);
|
const clusterId = await this.getClusterId(e);
|
||||||
|
await cluster.getClusterMetaTopics(clusterId);
|
||||||
this.resetFormValue(this.monitorType, e, null, this.consumerGroup, this.location);
|
this.resetFormValue(this.monitorType, e, null, this.consumerGroup, this.location);
|
||||||
topic.setLoading(false);
|
topic.setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -170,7 +177,7 @@ export class DynamicSetFilter extends React.Component<IDynamicProps> {
|
|||||||
}
|
}
|
||||||
this.consumerGroup = null;
|
this.consumerGroup = null;
|
||||||
this.location = null;
|
this.location = null;
|
||||||
this.resetFormValue(this.monitorType, this.clusterId, this.topicName);
|
this.resetFormValue(this.monitorType, this.clusterIdentification, this.topicName);
|
||||||
topic.setLoading(false);
|
topic.setLoading(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,17 +220,24 @@ export class DynamicSetFilter extends React.Component<IDynamicProps> {
|
|||||||
},
|
},
|
||||||
rules: [{ required: true, message: '请选择监控指标' }],
|
rules: [{ required: true, message: '请选择监控指标' }],
|
||||||
} as IVritualScrollSelect;
|
} as IVritualScrollSelect;
|
||||||
|
const clusterData = toJS(cluster.clusterData);
|
||||||
|
const options = clusterData?.length ? clusterData.map(item => {
|
||||||
|
return {
|
||||||
|
label: `${item.clusterName}${item.description ? '(' + item.description + ')' : ''}`,
|
||||||
|
value: item.clusterIdentification
|
||||||
|
}
|
||||||
|
}) : null;
|
||||||
|
|
||||||
const clusterItem = {
|
const clusterItem = {
|
||||||
label: '集群',
|
label: '集群',
|
||||||
options: cluster.clusterData,
|
options,
|
||||||
defaultValue: this.clusterId,
|
defaultValue: this.clusterIdentification,
|
||||||
rules: [{ required: true, message: '请选择集群' }],
|
rules: [{ required: true, message: '请选择集群' }],
|
||||||
attrs: {
|
attrs: {
|
||||||
placeholder: '请选择集群',
|
placeholder: '请选择集群',
|
||||||
className: 'middle-size',
|
className: 'large-size',
|
||||||
disabled: this.isDetailPage,
|
disabled: this.isDetailPage,
|
||||||
onChange: (e: number) => this.handleClusterChange(e),
|
onChange: (e: any) => this.handleClusterChange(e),
|
||||||
},
|
},
|
||||||
key: 'cluster',
|
key: 'cluster',
|
||||||
} as unknown as IVritualScrollSelect;
|
} as unknown as IVritualScrollSelect;
|
||||||
@@ -241,7 +255,7 @@ export class DynamicSetFilter extends React.Component<IDynamicProps> {
|
|||||||
}),
|
}),
|
||||||
attrs: {
|
attrs: {
|
||||||
placeholder: '请选择Topic',
|
placeholder: '请选择Topic',
|
||||||
className: 'middle-size',
|
className: 'large-size',
|
||||||
disabled: this.isDetailPage,
|
disabled: this.isDetailPage,
|
||||||
onChange: (e: string) => this.handleSelectChange(e, 'topic'),
|
onChange: (e: string) => this.handleSelectChange(e, 'topic'),
|
||||||
},
|
},
|
||||||
@@ -329,7 +343,7 @@ export class DynamicSetFilter extends React.Component<IDynamicProps> {
|
|||||||
key={v.value || v.key || index}
|
key={v.value || v.key || index}
|
||||||
value={v.value}
|
value={v.value}
|
||||||
>
|
>
|
||||||
{v.label.length > 25 ? <Tooltip placement="bottomLeft" title={v.label}>
|
{v.label?.length > 25 ? <Tooltip placement="bottomLeft" title={v.label}>
|
||||||
{v.label}
|
{v.label}
|
||||||
</Tooltip> : v.label}
|
</Tooltip> : v.label}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
|
|||||||
@@ -43,6 +43,11 @@
|
|||||||
Icon {
|
Icon {
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
}
|
}
|
||||||
|
.ant-form-item-label {
|
||||||
|
// padding-left: 10px;
|
||||||
|
width: 118px;
|
||||||
|
text-align: right !important;
|
||||||
|
}
|
||||||
|
|
||||||
&.type-form {
|
&.type-form {
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
@@ -50,14 +55,11 @@
|
|||||||
min-width: 755px;
|
min-width: 755px;
|
||||||
}
|
}
|
||||||
.ant-form-item {
|
.ant-form-item {
|
||||||
width: 30%;
|
width: 45%;
|
||||||
min-width: 360px;
|
min-width: 360px;
|
||||||
}
|
}
|
||||||
.ant-form-item-label {
|
|
||||||
padding-left: 10px;
|
|
||||||
}
|
|
||||||
.ant-form-item-control {
|
.ant-form-item-control {
|
||||||
width: 220px;
|
width: 300px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import { alarm } from 'store/alarm';
|
|||||||
import { app } from 'store/app';
|
import { app } from 'store/app';
|
||||||
import Url from 'lib/url-parser';
|
import Url from 'lib/url-parser';
|
||||||
import { IStrategyExpression, IRequestParams } from 'types/alarm';
|
import { IStrategyExpression, IRequestParams } from 'types/alarm';
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class AddAlarm extends SearchAndFilterContainer {
|
export class AddAlarm extends SearchAndFilterContainer {
|
||||||
public isDetailPage = window.location.pathname.includes('/alarm-detail'); // 判断是否为详情
|
public isDetailPage = window.location.pathname.includes('/alarm-detail'); // 判断是否为详情
|
||||||
@@ -90,8 +89,8 @@ export class AddAlarm extends SearchAndFilterContainer {
|
|||||||
const filterObj = this.typeForm.getFormData().filterObj;
|
const filterObj = this.typeForm.getFormData().filterObj;
|
||||||
// tslint:disable-next-line:max-line-length
|
// tslint:disable-next-line:max-line-length
|
||||||
if (!actionValue || !timeValue || !typeValue || !strategyList.length || !filterObj || !filterObj.filterList.length) {
|
if (!actionValue || !timeValue || !typeValue || !strategyList.length || !filterObj || !filterObj.filterList.length) {
|
||||||
message.error('请正确填写必填项');
|
message.error('请正确填写必填项');
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filterObj.monitorType === 'online-kafka-topic-throttled') {
|
if (filterObj.monitorType === 'online-kafka-topic-throttled') {
|
||||||
@@ -101,13 +100,17 @@ export class AddAlarm extends SearchAndFilterContainer {
|
|||||||
tval: [typeValue.app],
|
tval: [typeValue.app],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
this.id && filterObj.filterList.forEach((item: any) => {
|
||||||
|
if (item.tkey === 'cluster') {
|
||||||
|
item.tval = [item.clusterIdentification]
|
||||||
|
}
|
||||||
|
})
|
||||||
strategyList = strategyList.map((row: IStrategyExpression) => {
|
strategyList = strategyList.map((row: IStrategyExpression) => {
|
||||||
return {
|
return {
|
||||||
...row,
|
...row,
|
||||||
metric: filterObj.monitorType,
|
metric: filterObj.monitorType,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
appId: typeValue.app,
|
appId: typeValue.app,
|
||||||
name: typeValue.alarmName,
|
name: typeValue.alarmName,
|
||||||
@@ -129,7 +132,7 @@ export class AddAlarm extends SearchAndFilterContainer {
|
|||||||
public renderAlarmStrategy() {
|
public renderAlarmStrategy() {
|
||||||
return (
|
return (
|
||||||
<div className="config-wrapper">
|
<div className="config-wrapper">
|
||||||
<span className="span-tag">报警策略</span>
|
<span className="span-tag" data-set={alarm.monitorType}>报警策略</span>
|
||||||
<div className="info-wrapper">
|
<div className="info-wrapper">
|
||||||
<WrappedDynamicSetStrategy wrappedComponentRef={(form: any) => this.strategyForm = form} />
|
<WrappedDynamicSetStrategy wrappedComponentRef={(form: any) => this.strategyForm = form} />
|
||||||
</div>
|
</div>
|
||||||
@@ -139,9 +142,9 @@ export class AddAlarm extends SearchAndFilterContainer {
|
|||||||
|
|
||||||
public renderTimeForm() {
|
public renderTimeForm() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<WrappedTimeForm wrappedComponentRef={(form: any) => this.timeForm = form} />
|
<WrappedTimeForm wrappedComponentRef={(form: any) => this.timeForm = form} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +167,7 @@ export class AddAlarm extends SearchAndFilterContainer {
|
|||||||
{this.renderAlarmStrategy()}
|
{this.renderAlarmStrategy()}
|
||||||
{this.renderTimeForm()}
|
{this.renderTimeForm()}
|
||||||
<ActionForm ref={(actionForm) => this.actionForm = actionForm} />
|
<ActionForm ref={(actionForm) => this.actionForm = actionForm} />
|
||||||
</div>
|
</div>
|
||||||
</Spin>
|
</Spin>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { IStringMap } from 'types/base-type';
|
|||||||
import { IRequestParams } from 'types/alarm';
|
import { IRequestParams } from 'types/alarm';
|
||||||
import { IFormSelect, IFormItem, FormItemType } from 'component/x-form';
|
import { IFormSelect, IFormItem, FormItemType } from 'component/x-form';
|
||||||
import { searchProps } from 'constants/table';
|
import { searchProps } from 'constants/table';
|
||||||
|
import { alarm } from 'store/alarm';
|
||||||
|
|
||||||
interface IDynamicProps {
|
interface IDynamicProps {
|
||||||
form: any;
|
form: any;
|
||||||
@@ -27,6 +28,7 @@ class DynamicSetStrategy extends React.Component<IDynamicProps> {
|
|||||||
public crudList = [] as ICRUDItem[];
|
public crudList = [] as ICRUDItem[];
|
||||||
public state = {
|
public state = {
|
||||||
shouldUpdate: false,
|
shouldUpdate: false,
|
||||||
|
monitorType: alarm.monitorType
|
||||||
};
|
};
|
||||||
|
|
||||||
public componentDidMount() {
|
public componentDidMount() {
|
||||||
@@ -130,7 +132,7 @@ class DynamicSetStrategy extends React.Component<IDynamicProps> {
|
|||||||
|
|
||||||
if (lineValue.func === 'happen' && paramsArray.length > 1 && paramsArray[0] < paramsArray[1]) {
|
if (lineValue.func === 'happen' && paramsArray.length > 1 && paramsArray[0] < paramsArray[1]) {
|
||||||
strategyList = []; // 清空赋值
|
strategyList = []; // 清空赋值
|
||||||
return message.error('周期值应大于次数') ;
|
return message.error('周期值应大于次数');
|
||||||
}
|
}
|
||||||
|
|
||||||
lineValue.params = paramsArray.join(',');
|
lineValue.params = paramsArray.join(',');
|
||||||
@@ -292,8 +294,39 @@ class DynamicSetStrategy extends React.Component<IDynamicProps> {
|
|||||||
}
|
}
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
public unit(monitorType: string) {
|
||||||
public renderFormList(row: ICRUDItem) {
|
let element = null;
|
||||||
|
switch (monitorType) {
|
||||||
|
case 'online-kafka-topic-msgIn':
|
||||||
|
element = "条/秒"
|
||||||
|
break;
|
||||||
|
case 'online-kafka-topic-bytesIn':
|
||||||
|
element = "字节/秒"
|
||||||
|
break;
|
||||||
|
case 'online-kafka-topic-bytesRejected':
|
||||||
|
element = "字节/秒"
|
||||||
|
break;
|
||||||
|
case 'online-kafka-topic-produce-throttled':
|
||||||
|
element = "1表示被限流"
|
||||||
|
break;
|
||||||
|
case 'online-kafka-topic-fetch-throttled':
|
||||||
|
element = "1表示被限流"
|
||||||
|
break;
|
||||||
|
case 'online-kafka-consumer-maxLag':
|
||||||
|
element = "条"
|
||||||
|
break;
|
||||||
|
case 'online-kafka-consumer-lag':
|
||||||
|
element = "条"
|
||||||
|
break;
|
||||||
|
case 'online-kafka-consumer-maxDelayTime':
|
||||||
|
element = "秒"
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<span>{element}</span>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
public renderFormList(row: ICRUDItem, monitorType: string) {
|
||||||
const key = row.id;
|
const key = row.id;
|
||||||
const funcType = row.func;
|
const funcType = row.func;
|
||||||
|
|
||||||
@@ -309,6 +342,7 @@ class DynamicSetStrategy extends React.Component<IDynamicProps> {
|
|||||||
key: key + '-func',
|
key: key + '-func',
|
||||||
} as IFormSelect)}
|
} as IFormSelect)}
|
||||||
{this.getFuncItem(row)}
|
{this.getFuncItem(row)}
|
||||||
|
{row.func !== 'c_avg_rate_abs' && row.func !== 'pdiff' ? this.unit(monitorType) : null}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -340,8 +374,8 @@ class DynamicSetStrategy extends React.Component<IDynamicProps> {
|
|||||||
<Form>
|
<Form>
|
||||||
{crudList.map((row, index) => {
|
{crudList.map((row, index) => {
|
||||||
return (
|
return (
|
||||||
<div key={index}>
|
<div key={`${index}-${this.state.monitorType}`}>
|
||||||
{this.renderFormList(row)}
|
{this.renderFormList(row, alarm.monitorType)}
|
||||||
{
|
{
|
||||||
crudList.length > 1 ? (
|
crudList.length > 1 ? (
|
||||||
<Icon
|
<Icon
|
||||||
|
|||||||
@@ -50,23 +50,23 @@ export class TypeForm extends React.Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="config-wrapper">
|
<div className="config-wrapper">
|
||||||
<span className="span-tag">基本信息</span>
|
<span className="span-tag">基本信息</span>
|
||||||
<div className="alarm-x-form type-form">
|
<div className="alarm-x-form type-form">
|
||||||
<XFormComponent
|
<XFormComponent
|
||||||
ref={form => this.$form = form}
|
ref={form => this.$form = form}
|
||||||
formData={formData}
|
formData={formData}
|
||||||
formMap={xTypeFormMap}
|
formMap={xTypeFormMap}
|
||||||
layout="inline"
|
layout="inline"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div >
|
</div >
|
||||||
<div className="config-wrapper">
|
<div className="config-wrapper">
|
||||||
<span className="span-tag">选择指标</span>
|
<span className="span-tag">选择指标</span>
|
||||||
<div className="alarm-x-form type-form">
|
<div className="alarm-x-form type-form">
|
||||||
<WrappedDynamicSetFilter wrappedComponentRef={(form: any) => this.filterForm = form} />
|
<WrappedDynamicSetFilter wrappedComponentRef={(form: any) => this.filterForm = form} />
|
||||||
</div>
|
</div>
|
||||||
</div >
|
</div >
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,11 +31,11 @@ export class ClusterOverview extends React.Component<IOverview> {
|
|||||||
const content = this.props.basicInfo as IBasicInfo;
|
const content = this.props.basicInfo as IBasicInfo;
|
||||||
const clusterContent = [{
|
const clusterContent = [{
|
||||||
value: content.clusterName,
|
value: content.clusterName,
|
||||||
label: '集群中文名称',
|
label: '集群名称',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: content.clusterName,
|
value: content.clusterIdentification,
|
||||||
label: '集群英文名称',
|
label: '集群标识',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: clusterTypeMap[content.mode],
|
value: clusterTypeMap[content.mode],
|
||||||
@@ -44,8 +44,8 @@ export class ClusterOverview extends React.Component<IOverview> {
|
|||||||
value: moment(content.gmtCreate).format(timeFormat),
|
value: moment(content.gmtCreate).format(timeFormat),
|
||||||
label: '接入时间',
|
label: '接入时间',
|
||||||
}, {
|
}, {
|
||||||
value: content.physicalClusterId,
|
value: content.clusterId,
|
||||||
label: '物理集群ID',
|
label: '集群ID',
|
||||||
}];
|
}];
|
||||||
const clusterInfo = [{
|
const clusterInfo = [{
|
||||||
value: content.clusterVersion,
|
value: content.clusterVersion,
|
||||||
|
|||||||
@@ -13,32 +13,14 @@ const { confirm } = Modal;
|
|||||||
export const getClusterColumns = (urlPrefix: string) => {
|
export const getClusterColumns = (urlPrefix: string) => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
title: '逻辑集群ID',
|
title: '集群ID',
|
||||||
dataIndex: 'clusterId',
|
dataIndex: 'clusterId',
|
||||||
key: 'clusterId',
|
key: 'clusterId',
|
||||||
width: '9%',
|
width: '9%',
|
||||||
sorter: (a: IClusterData, b: IClusterData) => b.clusterId - a.clusterId,
|
sorter: (a: IClusterData, b: IClusterData) => b.clusterId - a.clusterId,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '逻辑集群中文名称',
|
title: '集群名称',
|
||||||
dataIndex: 'clusterName',
|
|
||||||
key: 'clusterName',
|
|
||||||
width: '13%',
|
|
||||||
onCell: () => ({
|
|
||||||
style: {
|
|
||||||
maxWidth: 120,
|
|
||||||
...cellStyle,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
sorter: (a: IClusterData, b: IClusterData) => a.clusterName.charCodeAt(0) - b.clusterName.charCodeAt(0),
|
|
||||||
render: (text: string, record: IClusterData) => (
|
|
||||||
<Tooltip placement="bottomLeft" title={text} >
|
|
||||||
<a href={`${urlPrefix}/cluster/cluster-detail?clusterId=${record.clusterId}`}> {text} </a>
|
|
||||||
</Tooltip>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '逻辑集群英文名称',
|
|
||||||
dataIndex: 'clusterName',
|
dataIndex: 'clusterName',
|
||||||
key: 'clusterName',
|
key: 'clusterName',
|
||||||
width: '13%',
|
width: '13%',
|
||||||
@@ -55,6 +37,24 @@ export const getClusterColumns = (urlPrefix: string) => {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// title: '逻辑集群英文名称',
|
||||||
|
// dataIndex: 'clusterName',
|
||||||
|
// key: 'clusterName',
|
||||||
|
// width: '13%',
|
||||||
|
// onCell: () => ({
|
||||||
|
// style: {
|
||||||
|
// maxWidth: 120,
|
||||||
|
// ...cellStyle,
|
||||||
|
// },
|
||||||
|
// }),
|
||||||
|
// sorter: (a: IClusterData, b: IClusterData) => a.clusterName.charCodeAt(0) - b.clusterName.charCodeAt(0),
|
||||||
|
// render: (text: string, record: IClusterData) => (
|
||||||
|
// <Tooltip placement="bottomLeft" title={text} >
|
||||||
|
// <a href={`${urlPrefix}/cluster/cluster-detail?clusterId=${record.clusterId}`}> {text} </a>
|
||||||
|
// </Tooltip>
|
||||||
|
// ),
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
title: 'Topic数量',
|
title: 'Topic数量',
|
||||||
dataIndex: 'topicNum',
|
dataIndex: 'topicNum',
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ export class MyCluster extends SearchAndFilterContainer {
|
|||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
pattern: /^.{5,}.$/,
|
pattern: /^.{4,}.$/,
|
||||||
message: '请输入至少5个字符',
|
message: '请输入至少5个字符',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -160,7 +160,7 @@ export class MyCluster extends SearchAndFilterContainer {
|
|||||||
|
|
||||||
data = searchKey ? origin.filter((item: IClusterData) =>
|
data = searchKey ? origin.filter((item: IClusterData) =>
|
||||||
(item.clusterName !== undefined && item.clusterName !== null) && item.clusterName.toLowerCase().includes(searchKey as string),
|
(item.clusterName !== undefined && item.clusterName !== null) && item.clusterName.toLowerCase().includes(searchKey as string),
|
||||||
) : origin ;
|
) : origin;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ class DataMigrationFormTable extends React.Component<IFormTableProps> {
|
|||||||
key: 'retentionTime', // originalRetentionTime
|
key: 'retentionTime', // originalRetentionTime
|
||||||
width: '132px',
|
width: '132px',
|
||||||
sorter: (a: IRenderData, b: IRenderData) => b.retentionTime - a.retentionTime,
|
sorter: (a: IRenderData, b: IRenderData) => b.retentionTime - a.retentionTime,
|
||||||
render: (time: any) => transMSecondToHour(time),
|
render: (time: any) => transMSecondToHour(time),
|
||||||
}, {
|
}, {
|
||||||
title: 'BrokerID',
|
title: 'BrokerID',
|
||||||
dataIndex: 'brokerIdList',
|
dataIndex: 'brokerIdList',
|
||||||
@@ -254,7 +254,7 @@ class DataMigrationFormTable extends React.Component<IFormTableProps> {
|
|||||||
dataSource={this.props.data}
|
dataSource={this.props.data}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
pagination={false}
|
pagination={false}
|
||||||
scroll={{y: 520}}
|
scroll={{ y: 520 }}
|
||||||
className="migration-table"
|
className="migration-table"
|
||||||
/>
|
/>
|
||||||
</EditableContext.Provider>
|
</EditableContext.Provider>
|
||||||
@@ -316,7 +316,7 @@ export class InfoForm extends React.Component<IFormTableProps> {
|
|||||||
<Form.Item label="迁移说明" key={2} className="form-item">
|
<Form.Item label="迁移说明" key={2} className="form-item">
|
||||||
{getFieldDecorator('description', {
|
{getFieldDecorator('description', {
|
||||||
initialValue: '',
|
initialValue: '',
|
||||||
rules: [{ required: true, message: '请输入至少5个字符', pattern: /^.{5,}.$/ }],
|
rules: [{ required: true, message: '请输入至少5个字符', pattern: /^.{4,}.$/ }],
|
||||||
})(
|
})(
|
||||||
<Input.TextArea rows={5} placeholder="请输入至少5个字符" />,
|
<Input.TextArea rows={5} placeholder="请输入至少5个字符" />,
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -23,13 +23,22 @@ export const showEditClusterTopic = (item: IClusterTopics) => {
|
|||||||
{
|
{
|
||||||
key: 'appId',
|
key: 'appId',
|
||||||
label: '应用ID',
|
label: '应用ID',
|
||||||
|
type: 'select',
|
||||||
|
options: app.adminAppData.map(item => {
|
||||||
|
return {
|
||||||
|
label: item.appId,
|
||||||
|
value: item.appId,
|
||||||
|
};
|
||||||
|
}),
|
||||||
rules: [{
|
rules: [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入应用ID',
|
// message: '请输入应用ID',
|
||||||
|
// message: '请输入应用ID,应用名称只支持字母、数字、下划线、短划线,长度限制在3-64字符',
|
||||||
|
// pattern: /[_a-zA-Z0-9_-]{3,64}$/,
|
||||||
}],
|
}],
|
||||||
attrs: {
|
attrs: {
|
||||||
placeholder: '请输入应用ID',
|
placeholder: '请输入应用ID',
|
||||||
disabled: true,
|
// disabled: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -104,7 +113,7 @@ export const showLogicalClusterOpModal = (clusterId: number, record?: ILogicalCl
|
|||||||
}
|
}
|
||||||
const updateFormModal = (isShow: boolean) => {
|
const updateFormModal = (isShow: boolean) => {
|
||||||
const formMap = wrapper.xFormWrapper.formMap;
|
const formMap = wrapper.xFormWrapper.formMap;
|
||||||
isShow ? formMap.splice(2, 0,
|
isShow ? formMap.splice(3, 0,
|
||||||
{
|
{
|
||||||
key: 'appId',
|
key: 'appId',
|
||||||
label: '所属应用',
|
label: '所属应用',
|
||||||
@@ -119,7 +128,7 @@ export const showLogicalClusterOpModal = (clusterId: number, record?: ILogicalCl
|
|||||||
attrs: {
|
attrs: {
|
||||||
placeholder: '请选择所属应用',
|
placeholder: '请选择所属应用',
|
||||||
},
|
},
|
||||||
}) : formMap.splice(2, 1);
|
}) : formMap.splice(3, 1);
|
||||||
const formData = wrapper.xFormWrapper.formData;
|
const formData = wrapper.xFormWrapper.formData;
|
||||||
wrapper.ref && wrapper.ref.updateFormMap$(formMap, formData || {});
|
wrapper.ref && wrapper.ref.updateFormMap$(formMap, formData || {});
|
||||||
};
|
};
|
||||||
@@ -129,30 +138,30 @@ export const showLogicalClusterOpModal = (clusterId: number, record?: ILogicalCl
|
|||||||
formMap: [
|
formMap: [
|
||||||
{
|
{
|
||||||
key: 'logicalClusterName',
|
key: 'logicalClusterName',
|
||||||
label: '逻辑集群中文名称',
|
label: '逻辑集群名称',
|
||||||
// defaultValue:'',
|
// defaultValue:'',
|
||||||
rules: [{
|
rules: [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入逻辑集群中文名称,支持中文、字母、数字、下划线(_)和短划线(-)组成,长度在3-128字符之间', // 不能以下划线(_)和短划线(-)开头和结尾
|
message: '请输入逻辑集群名称,支持中文、字母、数字、下划线(_)和短划线(-)组成,长度在3-128字符之间', // 不能以下划线(_)和短划线(-)开头和结尾
|
||||||
pattern: /^[a-zA-Z0-9_\-\u4e00-\u9fa5]{3,128}$/g, //(?!(_|\-))(?!.*?(_|\-)$)
|
pattern: /^[a-zA-Z0-9_\-\u4e00-\u9fa5]{3,128}$/g, //(?!(_|\-))(?!.*?(_|\-)$)
|
||||||
}],
|
}],
|
||||||
attrs: {
|
attrs: {
|
||||||
// disabled: record ? true : false,
|
// disabled: record ? true : false,
|
||||||
placeholder:'请输入逻辑集群中文名称'
|
placeholder: '请输入逻辑集群名称'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'logicalClusterName1',
|
key: 'logicalClusterIdentification',
|
||||||
label: '逻辑集群英文名称',
|
label: '逻辑集群标识',
|
||||||
// defaultValue:'',
|
// defaultValue:'',
|
||||||
rules: [{
|
rules: [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入逻辑集群英文名称,支持字母、数字、下划线(_)和短划线(-)组成,长度在3-128字符之间', //不能以下划线(_)和短划线(-)开头和结尾
|
message: '请输入逻辑集群标识,支持字母、数字、下划线(_)和短划线(-)组成,长度在3-128字符之间', //不能以下划线(_)和短划线(-)开头和结尾
|
||||||
pattern:/^[a-zA-Z0-9_\-]{3,128}$/g, //(?!(_|\-))(?!.*?(_|\-)$)
|
pattern: /^[a-zA-Z0-9_\-]{3,128}$/g, //(?!(_|\-))(?!.*?(_|\-)$)
|
||||||
}],
|
}],
|
||||||
attrs: {
|
attrs: {
|
||||||
disabled: record ? true : false,
|
disabled: record ? true : false,
|
||||||
placeholder:'请输入逻辑集群英文名称,创建后无法修改'
|
placeholder: '请输入逻辑集标识,创建后无法修改'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -233,7 +242,7 @@ export const showLogicalClusterOpModal = (clusterId: number, record?: ILogicalCl
|
|||||||
id: record ? record.logicalClusterId : '',
|
id: record ? record.logicalClusterId : '',
|
||||||
mode: value.mode,
|
mode: value.mode,
|
||||||
name: value.logicalClusterName,
|
name: value.logicalClusterName,
|
||||||
englishName:value.logicalClusterEName, // 存储逻辑集群英文名称
|
identification: value.logicalClusterIdentification,
|
||||||
regionIdList: value.regionIdList,
|
regionIdList: value.regionIdList,
|
||||||
} as INewLogical;
|
} as INewLogical;
|
||||||
if (record) {
|
if (record) {
|
||||||
@@ -246,7 +255,25 @@ export const showLogicalClusterOpModal = (clusterId: number, record?: ILogicalCl
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
if (record && record.mode != 0) {
|
||||||
|
isShow = true;
|
||||||
|
let formMap: any = xFormModal.formMap
|
||||||
|
formMap.splice(3, 0, {
|
||||||
|
key: 'appId',
|
||||||
|
label: '所属应用',
|
||||||
|
rules: [{ required: true, message: '请选择所属应用' }],
|
||||||
|
type: 'select',
|
||||||
|
options: app.adminAppData.map(item => {
|
||||||
|
return {
|
||||||
|
label: item.name,
|
||||||
|
value: item.appId,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
attrs: {
|
||||||
|
placeholder: '请选择所属应用',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
wrapper.open(xFormModal);
|
wrapper.open(xFormModal);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,10 @@ class CustomForm extends React.Component<IXFormProps> {
|
|||||||
notification.success({ message: '扩分成功' });
|
notification.success({ message: '扩分成功' });
|
||||||
this.props.form.resetFields();
|
this.props.form.resetFields();
|
||||||
admin.getClusterTopics(this.props.clusterId);
|
admin.getClusterTopics(this.props.clusterId);
|
||||||
});
|
}).catch(err => {
|
||||||
|
notification.error({ message: '扩分成功' });
|
||||||
|
|
||||||
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -93,7 +96,7 @@ class CustomForm extends React.Component<IXFormProps> {
|
|||||||
{/* 运维管控-topic信息-扩分区操作 */}
|
{/* 运维管控-topic信息-扩分区操作 */}
|
||||||
<Form.Item label="所属region" >
|
<Form.Item label="所属region" >
|
||||||
{getFieldDecorator('regionNameList', {
|
{getFieldDecorator('regionNameList', {
|
||||||
initialValue: admin.topicsBasic ? admin.topicsBasic.regionNameList : '',
|
initialValue: admin.topicsBasic && admin.topicsBasic.regionNameList.length > 0 ? admin.topicsBasic.regionNameList.join(',') : ' ',
|
||||||
rules: [{ required: true, message: '请输入所属region' }],
|
rules: [{ required: true, message: '请输入所属region' }],
|
||||||
})(<Input disabled={true} />)}
|
})(<Input disabled={true} />)}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|||||||
@@ -186,10 +186,10 @@ export const createMigrationTasks = () => {
|
|||||||
label: '初始限流',
|
label: '初始限流',
|
||||||
rules: [{
|
rules: [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入初始限流',
|
message: '请输入初始限流,并按照:“限流上限>初始限流>限流下限”的大小顺序',
|
||||||
}],
|
}],
|
||||||
attrs: {
|
attrs: {
|
||||||
placeholder: '请输入初始限流',
|
placeholder: '请输入初始限流,并按照:“限流上限>初始限流>限流下限”的大小顺序',
|
||||||
suffix: 'MB/s',
|
suffix: 'MB/s',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -198,10 +198,10 @@ export const createMigrationTasks = () => {
|
|||||||
label: '限流上限',
|
label: '限流上限',
|
||||||
rules: [{
|
rules: [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入限流上限',
|
message: '请输入限流上限,并按照:“限流上限>初始限流>限流下限”的大小顺序',
|
||||||
}],
|
}],
|
||||||
attrs: {
|
attrs: {
|
||||||
placeholder: '请输入限流上限',
|
placeholder: '请输入限流上限,并按照:“限流上限>初始限流>限流下限”的大小顺序',
|
||||||
suffix: 'MB/s',
|
suffix: 'MB/s',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -210,10 +210,10 @@ export const createMigrationTasks = () => {
|
|||||||
label: '限流下限',
|
label: '限流下限',
|
||||||
rules: [{
|
rules: [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入限流下限',
|
message: '请输入限流下限,并按照:“限流上限>初始限流>限流下限”的大小顺序',
|
||||||
}],
|
}],
|
||||||
attrs: {
|
attrs: {
|
||||||
placeholder: '请输入限流下限',
|
placeholder: '请输入限流下限,并按照:“限流上限>初始限流>限流下限”的大小顺序',
|
||||||
suffix: 'MB/s',
|
suffix: 'MB/s',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -224,7 +224,7 @@ export const createMigrationTasks = () => {
|
|||||||
rules: [{
|
rules: [{
|
||||||
required: false,
|
required: false,
|
||||||
message: '请输入至少5个字符',
|
message: '请输入至少5个字符',
|
||||||
pattern: /^.{5,}.$/,
|
pattern: /^.{4,}.$/,
|
||||||
}],
|
}],
|
||||||
attrs: {
|
attrs: {
|
||||||
placeholder: '请输入备注',
|
placeholder: '请输入备注',
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export const showEditModal = (record?: IAppItem, from?: string, isDisabled?: boo
|
|||||||
rules: [{
|
rules: [{
|
||||||
required: isDisabled ? false : true,
|
required: isDisabled ? false : true,
|
||||||
message: '应用名称只支持中文、字母、数字、下划线、短划线,长度限制在3-64字符',
|
message: '应用名称只支持中文、字母、数字、下划线、短划线,长度限制在3-64字符',
|
||||||
pattern: /[\u4e00-\u9fa5_a-zA-Z0-9_-]{3,64}/,
|
pattern: /[\u4e00-\u9fa5_a-zA-Z0-9_-]{3,64}$/,
|
||||||
}],
|
}],
|
||||||
attrs: { disabled: isDisabled },
|
attrs: { disabled: isDisabled },
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export const showCpacityModal = (item: IClusterData) => {
|
|||||||
key: 'description',
|
key: 'description',
|
||||||
label: '申请原因',
|
label: '申请原因',
|
||||||
type: 'text_area',
|
type: 'text_area',
|
||||||
rules: [{ required: true, pattern: /^.{5,}.$/, message: '请输入至少5个字符' }],
|
rules: [{ required: true, pattern: /^.{4,}.$/, message: '请输入至少5个字符' }],
|
||||||
attrs: {
|
attrs: {
|
||||||
placeholder: '请输入至少5个字符',
|
placeholder: '请输入至少5个字符',
|
||||||
},
|
},
|
||||||
@@ -44,12 +44,12 @@ export const showCpacityModal = (item: IClusterData) => {
|
|||||||
type: value.type,
|
type: value.type,
|
||||||
applicant: users.currentUser.username,
|
applicant: users.currentUser.username,
|
||||||
description: value.description,
|
description: value.description,
|
||||||
extensions: JSON.stringify({clusterId: item.clusterId}),
|
extensions: JSON.stringify({ clusterId: item.clusterId }),
|
||||||
};
|
};
|
||||||
cluster.applyCpacity(cpacityParams).then(data => {
|
cluster.applyCpacity(cpacityParams).then(data => {
|
||||||
notification.success({
|
notification.success({
|
||||||
message: `申请${value.type === 5 ? '扩容' : '缩容'}成功`,
|
message: `申请${value.type === 5 ? '扩容' : '缩容'}成功`,
|
||||||
});
|
});
|
||||||
window.location.href = `${urlPrefix}/user/order-detail/?orderId=${data.id}®ion=${region.currentRegion}`;
|
window.location.href = `${urlPrefix}/user/order-detail/?orderId=${data.id}®ion=${region.currentRegion}`;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export const applyTopic = () => {
|
|||||||
formMap: [
|
formMap: [
|
||||||
{
|
{
|
||||||
key: 'clusterId',
|
key: 'clusterId',
|
||||||
label: '所属逻辑集群:',
|
label: '所属集群:',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
options: cluster.clusterData,
|
options: cluster.clusterData,
|
||||||
rules: [{ required: true, message: '请选择' }],
|
rules: [{ required: true, message: '请选择' }],
|
||||||
@@ -75,7 +75,7 @@ export const applyTopic = () => {
|
|||||||
key: 'description',
|
key: 'description',
|
||||||
label: '申请原因',
|
label: '申请原因',
|
||||||
type: 'text_area',
|
type: 'text_area',
|
||||||
rules: [{ required: true, pattern: /^.{5,}.$/s, message: '请输入至少5个字符' }],
|
rules: [{ required: true, pattern: /^.{4,}.$/s, message: '请输入至少5个字符' }],
|
||||||
attrs: {
|
attrs: {
|
||||||
placeholder: `概要描述Topic的数据源, Topic数据的生产者/消费者, Topic的申请原因及备注信息等。(最多100个字)
|
placeholder: `概要描述Topic的数据源, Topic数据的生产者/消费者, Topic的申请原因及备注信息等。(最多100个字)
|
||||||
例如:
|
例如:
|
||||||
@@ -180,13 +180,14 @@ export const showApplyQuatoModal = (item: ITopic | IAppsIdInfo, record: IQuotaQu
|
|||||||
const isConsume = item.access === 0 || item.access === 2;
|
const isConsume = item.access === 0 || item.access === 2;
|
||||||
const xFormModal = {
|
const xFormModal = {
|
||||||
formMap: [
|
formMap: [
|
||||||
|
// {
|
||||||
|
// key: 'clusterName',
|
||||||
|
// label: '逻辑集群名称',
|
||||||
|
// rules: [{ required: true, message: '' }],
|
||||||
|
// attrs: { disabled: true },
|
||||||
|
// invisible: !item.hasOwnProperty('clusterName'),
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
key: 'clusterName',
|
|
||||||
label: '逻辑集群名称',
|
|
||||||
rules: [{ required: true, message: '' }],
|
|
||||||
attrs: { disabled: true },
|
|
||||||
invisible: !item.hasOwnProperty('clusterName'),
|
|
||||||
}, {
|
|
||||||
key: 'topicName',
|
key: 'topicName',
|
||||||
label: 'Topic名称',
|
label: 'Topic名称',
|
||||||
rules: [{ required: true, message: '' }],
|
rules: [{ required: true, message: '' }],
|
||||||
@@ -225,7 +226,7 @@ export const showApplyQuatoModal = (item: ITopic | IAppsIdInfo, record: IQuotaQu
|
|||||||
key: 'description',
|
key: 'description',
|
||||||
label: '申请原因',
|
label: '申请原因',
|
||||||
type: 'text_area',
|
type: 'text_area',
|
||||||
rules: [{ required: true, pattern: /^.{5,}.$/, message: quotaRemarks }],
|
rules: [{ required: true, pattern: /^.{4,}.$/, message: quotaRemarks }],
|
||||||
attrs: {
|
attrs: {
|
||||||
placeholder: quotaRemarks,
|
placeholder: quotaRemarks,
|
||||||
},
|
},
|
||||||
@@ -292,13 +293,15 @@ const updateFormModal = (appId: string) => {
|
|||||||
export const showTopicApplyQuatoModal = (item: ITopic) => {
|
export const showTopicApplyQuatoModal = (item: ITopic) => {
|
||||||
const xFormModal = {
|
const xFormModal = {
|
||||||
formMap: [
|
formMap: [
|
||||||
|
// {
|
||||||
|
// key: 'clusterName',
|
||||||
|
// label: '逻辑集群名称',
|
||||||
|
// rules: [{ required: true, message: '' }],
|
||||||
|
// attrs: { disabled: true },
|
||||||
|
// defaultValue: item.clusterName,
|
||||||
|
// // invisible: !item.hasOwnProperty('clusterName'),
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
key: 'clusterName',
|
|
||||||
label: '逻辑集群名称',
|
|
||||||
rules: [{ required: true, message: '' }],
|
|
||||||
attrs: { disabled: true },
|
|
||||||
// invisible: !item.hasOwnProperty('clusterName'),
|
|
||||||
}, {
|
|
||||||
key: 'topicName',
|
key: 'topicName',
|
||||||
label: 'Topic名称',
|
label: 'Topic名称',
|
||||||
rules: [{ required: true, message: '' }],
|
rules: [{ required: true, message: '' }],
|
||||||
@@ -530,7 +533,7 @@ const showAllPermission = (appId: string, item: ITopic, access: number) => {
|
|||||||
rules: [{
|
rules: [{
|
||||||
required: true,
|
required: true,
|
||||||
validator: (rule: any, value: string, callback: any) => {
|
validator: (rule: any, value: string, callback: any) => {
|
||||||
const regexp = /^.{5,}.$/;
|
const regexp = /^.{4,}.$/;
|
||||||
value = value.trim();
|
value = value.trim();
|
||||||
if (!regexp.test(value)) {
|
if (!regexp.test(value)) {
|
||||||
callback('请输入至少5个字符');
|
callback('请输入至少5个字符');
|
||||||
@@ -629,7 +632,7 @@ export const showPermissionModal = (item: ITopic) => {
|
|||||||
rules: [{
|
rules: [{
|
||||||
required: true,
|
required: true,
|
||||||
validator: (rule: any, value: string, callback: any) => {
|
validator: (rule: any, value: string, callback: any) => {
|
||||||
const regexp = /^.{5,}.$/;
|
const regexp = /^.{4,}.$/;
|
||||||
value = value.trim();
|
value = value.trim();
|
||||||
if (!regexp.test(value)) {
|
if (!regexp.test(value)) {
|
||||||
callback('请输入至少5个字符');
|
callback('请输入至少5个字符');
|
||||||
@@ -678,7 +681,7 @@ export const showTopicEditModal = (item: ITopic) => {
|
|||||||
key: 'description',
|
key: 'description',
|
||||||
label: '备注',
|
label: '备注',
|
||||||
type: 'text_area',
|
type: 'text_area',
|
||||||
rules: [{ required: false }, { pattern: /^.{5,}.$/, message: '请输入至少5个字符' }],
|
rules: [{ required: false }, { pattern: /^.{4,}.$/, message: '请输入至少5个字符' }],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
formData: {
|
formData: {
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ export const applyQuotaQuery = (item: ITopic) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const applyTopicQuotaQuery = async (item: ITopic) => {
|
export const applyTopicQuotaQuery = async (item: ITopic) => {
|
||||||
console.log(item)
|
|
||||||
await app.getTopicAppQuota(item.clusterId, item.topicName);
|
await app.getTopicAppQuota(item.clusterId, item.topicName);
|
||||||
await showTopicApplyQuatoModal(item);
|
await showTopicApplyQuatoModal(item);
|
||||||
};
|
};
|
||||||
@@ -142,7 +141,7 @@ export const getAllTopicColumns = (urlPrefix: string) => {
|
|||||||
<Tooltip placement="bottomLeft" title={record.topicName} >
|
<Tooltip placement="bottomLeft" title={record.topicName} >
|
||||||
<a
|
<a
|
||||||
// tslint:disable-next-line:max-line-length
|
// tslint:disable-next-line:max-line-length
|
||||||
href={`${urlPrefix}/topic/topic-detail?clusterId=${record.clusterId}&topic=${record.topicName}®ion=${region.currentRegion}&needAuth=${record.needAuth}&clusterName=${record.clusterName}`}
|
href={`${urlPrefix}/topic/topic-detail?clusterId=${record.clusterId}&topic=${record.topicName}®ion=${region.currentRegion}&needAuth=${record.needAuth}`}
|
||||||
>{text}</a>
|
>{text}</a>
|
||||||
</Tooltip>);
|
</Tooltip>);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export class AllTopic extends SearchAndFilterContainer {
|
|||||||
if (cluster.allActive !== -1 || searchKey !== '') {
|
if (cluster.allActive !== -1 || searchKey !== '') {
|
||||||
data = origin.filter(d =>
|
data = origin.filter(d =>
|
||||||
((d.topicName !== undefined && d.topicName !== null) && d.topicName.toLowerCase().includes(searchKey as string)
|
((d.topicName !== undefined && d.topicName !== null) && d.topicName.toLowerCase().includes(searchKey as string)
|
||||||
|| ((d.appPrincipals !== undefined && d.appPrincipals !== null) && d.appPrincipals.toLowerCase().includes(searchKey as string)))
|
|| ((d.appPrincipals !== undefined && d.appPrincipals !== null) && d.appPrincipals.toLowerCase().includes(searchKey as string)))
|
||||||
&& (cluster.allActive === -1 || d.clusterId === cluster.allActive),
|
&& (cluster.allActive === -1 || d.clusterId === cluster.allActive),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export class BaseInformation extends React.Component<IInfoProps> {
|
|||||||
label: '压缩格式',
|
label: '压缩格式',
|
||||||
value: baseInfo.topicCodeC,
|
value: baseInfo.topicCodeC,
|
||||||
}, {
|
}, {
|
||||||
label: '所属物理集群ID',
|
label: '集群ID',
|
||||||
value: baseInfo.clusterId,
|
value: baseInfo.clusterId,
|
||||||
}, {
|
}, {
|
||||||
label: '所属region',
|
label: '所属region',
|
||||||
|
|||||||
@@ -95,23 +95,23 @@ export class BillInformation extends SearchAndFilterContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
return(
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="k-row" >
|
<div className="k-row" >
|
||||||
<ul className="k-tab">
|
<ul className="k-tab">
|
||||||
<li>账单信息
|
<li>账单信息
|
||||||
<a
|
<a
|
||||||
// tslint:disable-next-line:max-line-length
|
// tslint:disable-next-line:max-line-length
|
||||||
href="https://github.com/didi/kafka-manager"
|
href="https://github.com/didi/kafka-manager"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
<Icon type="question-circle" />
|
<Icon type="question-circle" />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{this.renderDatePick()}
|
{this.renderDatePick()}
|
||||||
</ul>
|
</ul>
|
||||||
{this.renderChart()}
|
{this.renderChart()}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import './index.less';
|
import './index.less';
|
||||||
import { wrapper, region } from 'store';
|
import { wrapper, region } from 'store';
|
||||||
import { Tabs, PageHeader, Button, notification, Drawer, message, Icon } from 'antd';
|
import { Tabs, PageHeader, Button, notification, Drawer, message, Icon, Spin } from 'antd';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import { BaseInformation } from './base-information';
|
import { BaseInformation } from './base-information';
|
||||||
import { StatusChart } from './status-chart';
|
import { StatusChart } from './status-chart';
|
||||||
@@ -44,6 +44,7 @@ export class TopicDetail extends React.Component<any> {
|
|||||||
drawerVisible: false,
|
drawerVisible: false,
|
||||||
infoVisible: false,
|
infoVisible: false,
|
||||||
infoTopicList: [] as IInfoData[],
|
infoTopicList: [] as IInfoData[],
|
||||||
|
isExecutionBtn: false
|
||||||
};
|
};
|
||||||
private $formRef: any;
|
private $formRef: any;
|
||||||
|
|
||||||
@@ -54,7 +55,7 @@ export class TopicDetail extends React.Component<any> {
|
|||||||
const url = Url();
|
const url = Url();
|
||||||
this.clusterId = Number(url.search.clusterId);
|
this.clusterId = Number(url.search.clusterId);
|
||||||
this.needAuth = url.search.needAuth;
|
this.needAuth = url.search.needAuth;
|
||||||
this.clusterName = url.search.clusterName;
|
this.clusterName = decodeURI(decodeURI(url.search.clusterName));
|
||||||
this.topicName = url.search.topic;
|
this.topicName = url.search.topic;
|
||||||
const isPhysical = Url().search.hasOwnProperty('isPhysicalClusterId');
|
const isPhysical = Url().search.hasOwnProperty('isPhysicalClusterId');
|
||||||
this.isPhysicalTrue = isPhysical ? '&isPhysicalClusterId=true' : '';
|
this.isPhysicalTrue = isPhysical ? '&isPhysicalClusterId=true' : '';
|
||||||
@@ -197,7 +198,9 @@ export class TopicDetail extends React.Component<any> {
|
|||||||
formData={formData}
|
formData={formData}
|
||||||
formMap={formMap}
|
formMap={formMap}
|
||||||
/>
|
/>
|
||||||
<Button type="primary" onClick={this.drawerSubmit} className="sample-button">采样</Button>
|
<Button type="primary" onClick={this.drawerSubmit} className="sample-button" disabled={this.state.isExecutionBtn}>
|
||||||
|
{this.state.isExecutionBtn ? (<span>采样中<Spin indicator={this.antIcon} size="small" /></span>) : '采 样'}
|
||||||
|
</Button>
|
||||||
{infoVisible ? this.renderInfo() : null}
|
{infoVisible ? this.renderInfo() : null}
|
||||||
</Drawer>
|
</Drawer>
|
||||||
</>
|
</>
|
||||||
@@ -243,7 +246,11 @@ export class TopicDetail extends React.Component<any> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 执行加载图标
|
||||||
|
public antIcon = <Icon type="loading" style={{ fontSize: 12, color: '#cccccc', marginLeft: '5px' }} spin />
|
||||||
|
|
||||||
public drawerSubmit = (value: any) => {
|
public drawerSubmit = (value: any) => {
|
||||||
|
this.setState({ isExecutionBtn: true })
|
||||||
this.$formRef.validateFields((error: Error, result: any) => {
|
this.$formRef.validateFields((error: Error, result: any) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
return;
|
return;
|
||||||
@@ -253,9 +260,12 @@ export class TopicDetail extends React.Component<any> {
|
|||||||
this.setState({
|
this.setState({
|
||||||
infoTopicList: data,
|
infoTopicList: data,
|
||||||
infoVisible: true,
|
infoVisible: true,
|
||||||
|
isExecutionBtn: false
|
||||||
});
|
});
|
||||||
message.success('采样成功');
|
message.success('采样成功');
|
||||||
});
|
}).catch(err => {
|
||||||
|
this.setState({ isExecutionBtn: false })
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,6 +325,7 @@ export class TopicDetail extends React.Component<any> {
|
|||||||
public componentDidMount() {
|
public componentDidMount() {
|
||||||
topic.getTopicBasicInfo(this.clusterId, this.topicName);
|
topic.getTopicBasicInfo(this.clusterId, this.topicName);
|
||||||
topic.getTopicBusiness(this.clusterId, this.topicName);
|
topic.getTopicBusiness(this.clusterId, this.topicName);
|
||||||
|
app.getAppList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
@@ -326,7 +337,6 @@ export class TopicDetail extends React.Component<any> {
|
|||||||
topicName: this.topicName,
|
topicName: this.topicName,
|
||||||
clusterName: this.clusterName
|
clusterName: this.clusterName
|
||||||
} as ITopic;
|
} as ITopic;
|
||||||
app.getAppList();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -342,9 +352,9 @@ export class TopicDetail extends React.Component<any> {
|
|||||||
{this.needAuth == "true" && <Button key="0" type="primary" onClick={() => showAllPermissionModal(topicRecord)} >申请权限</Button>}
|
{this.needAuth == "true" && <Button key="0" type="primary" onClick={() => showAllPermissionModal(topicRecord)} >申请权限</Button>}
|
||||||
<Button key="1" type="primary" onClick={() => applyTopicQuotaQuery(topicRecord)} >申请配额</Button>
|
<Button key="1" type="primary" onClick={() => applyTopicQuotaQuery(topicRecord)} >申请配额</Button>
|
||||||
<Button key="2" type="primary" onClick={() => applyExpandModal(topicRecord)} >申请分区</Button>
|
<Button key="2" type="primary" onClick={() => applyExpandModal(topicRecord)} >申请分区</Button>
|
||||||
<Button key="3" type="primary" onClick={() => this.props.history.push(`/alarm/add`)} >新建告警规则</Button>
|
<Button key="3" type="primary" onClick={() => this.props.history.push(`/alarm/add`)} >新建告警</Button>
|
||||||
<Button key="4" type="primary" onClick={this.showDrawer.bind(this)} >采样</Button>
|
<Button key="4" type="primary" onClick={this.showDrawer.bind(this)} >数据采样</Button>
|
||||||
{showEditBtn && <Button key="5" onClick={() => this.compileDetails()} type="primary">编辑</Button>}
|
{/* {showEditBtn && <Button key="5" onClick={() => this.compileDetails()} type="primary">编辑</Button>} */}
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export class MineTopic extends SearchAndFilterContainer {
|
|||||||
if (cluster.active !== -1 || app.active !== '-1' || searchKey !== '') {
|
if (cluster.active !== -1 || app.active !== '-1' || searchKey !== '') {
|
||||||
data = origin.filter(d =>
|
data = origin.filter(d =>
|
||||||
((d.topicName !== undefined && d.topicName !== null) && d.topicName.toLowerCase().includes(searchKey as string)
|
((d.topicName !== undefined && d.topicName !== null) && d.topicName.toLowerCase().includes(searchKey as string)
|
||||||
|| ((d.appName !== undefined && d.appName !== null) && d.appName.toLowerCase().includes(searchKey as string)))
|
|| ((d.appName !== undefined && d.appName !== null) && d.appName.toLowerCase().includes(searchKey as string)))
|
||||||
&& (cluster.active === -1 || d.clusterId === cluster.active)
|
&& (cluster.active === -1 || d.clusterId === cluster.active)
|
||||||
&& (app.active === '-1' || d.appId === (app.active + '')),
|
&& (app.active === '-1' || d.appId === (app.active + '')),
|
||||||
);
|
);
|
||||||
@@ -152,18 +152,18 @@ export class MineTopic extends SearchAndFilterContainer {
|
|||||||
public render() {
|
public render() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="min-width">
|
<div className="min-width">
|
||||||
<Tabs activeKey={location.hash.substr(1) || '1'} type="card" onChange={(key) => this.handleTabKey(key)}>
|
<Tabs activeKey={location.hash.substr(1) || '1'} type="card" onChange={(key) => this.handleTabKey(key)}>
|
||||||
<TabPane tab="有效Topic" key="1" >
|
<TabPane tab="有效Topic" key="1" >
|
||||||
{this.renderOperationPanel(1)}
|
{this.renderOperationPanel(1)}
|
||||||
{this.renderMyTopicTable(this.getData(topic.mytopicData))}
|
{this.renderMyTopicTable(this.getData(topic.mytopicData))}
|
||||||
</TabPane>
|
</TabPane>
|
||||||
<TabPane tab="已过期Topic" key="2">
|
<TabPane tab="已过期Topic" key="2">
|
||||||
{this.renderOperationPanel(2)}
|
{this.renderOperationPanel(2)}
|
||||||
{this.renderDeprecatedTopicTable(this.getData(topic.expireData))}
|
{this.renderDeprecatedTopicTable(this.getData(topic.expireData))}
|
||||||
</TabPane>
|
</TabPane>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ export class MyBill extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public renderTableList() {
|
public renderTableList() {
|
||||||
const userUrl=`${urlPrefix}/user/bill-detail`
|
const userUrl = `${urlPrefix}/user/bill-detail`
|
||||||
return (
|
return (
|
||||||
<Table
|
<Table
|
||||||
rowKey="key"
|
rowKey="key"
|
||||||
@@ -93,7 +93,7 @@ export class MyBill extends React.Component {
|
|||||||
public renderChart() {
|
public renderChart() {
|
||||||
return (
|
return (
|
||||||
<div className="chart-box">
|
<div className="chart-box">
|
||||||
<BarChartComponet ref={(ref) => this.chart = ref } getChartData={this.getData.bind(this, null)} />
|
<BarChartComponet ref={(ref) => this.chart = ref} getChartData={this.getData.bind(this, null)} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ const checkStatus = (res: Response) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const filter = (init: IInit) => (res: IRes) => {
|
const filter = (init: IInit) => (res: IRes) => {
|
||||||
|
|
||||||
if (res.code !== 0 && res.code !== 200) {
|
if (res.code !== 0 && res.code !== 200) {
|
||||||
if (!init.errorNoTips) {
|
if (!init.errorNoTips) {
|
||||||
notification.error({
|
notification.error({
|
||||||
|
|||||||
@@ -96,7 +96,8 @@ class Alarm {
|
|||||||
@action.bound
|
@action.bound
|
||||||
public setMonitorType(data: IMonitorMetricType) {
|
public setMonitorType(data: IMonitorMetricType) {
|
||||||
this.monitorTypeList = data.metricNames || [];
|
this.monitorTypeList = data.metricNames || [];
|
||||||
this.monitorType = this.monitorTypeList[0].metricName;
|
// this.monitorType = this.monitorTypeList[0].metricName;
|
||||||
|
this.monitorType = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@action.bound
|
@action.bound
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class Cluster {
|
|||||||
public selectData: IClusterData[] = [{
|
public selectData: IClusterData[] = [{
|
||||||
value: -1,
|
value: -1,
|
||||||
label: '所有集群',
|
label: '所有集群',
|
||||||
} as IClusterData,
|
} as IClusterData,
|
||||||
];
|
];
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
@@ -31,7 +31,7 @@ class Cluster {
|
|||||||
public selectAllData: IClusterData[] = [{
|
public selectAllData: IClusterData[] = [{
|
||||||
value: -1,
|
value: -1,
|
||||||
label: '所有集群',
|
label: '所有集群',
|
||||||
} as IClusterData,
|
} as IClusterData,
|
||||||
];
|
];
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
@@ -59,7 +59,7 @@ class Cluster {
|
|||||||
public clusterMetrics: IClusterMetrics[] = [];
|
public clusterMetrics: IClusterMetrics[] = [];
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
public type: IOptionType = 'byteIn/byteOut' ;
|
public type: IOptionType = 'byteIn/byteOut';
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
public clusterTopics: IClusterTopics[] = [];
|
public clusterTopics: IClusterTopics[] = [];
|
||||||
@@ -130,11 +130,11 @@ class Cluster {
|
|||||||
public setClusterCombos(data: IConfigInfo[]) {
|
public setClusterCombos(data: IConfigInfo[]) {
|
||||||
this.clusterComboList = data || [];
|
this.clusterComboList = data || [];
|
||||||
this.clusterComboList = this.clusterComboList.map(item => {
|
this.clusterComboList = this.clusterComboList.map(item => {
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
label: item.message,
|
label: item.message,
|
||||||
value: item.code,
|
value: item.code,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ class Cluster {
|
|||||||
value: item.code,
|
value: item.code,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
this.clusterMode = (this.clusterModes && this.clusterModes.filter(ele => ele.code !== 0) ) || []; // 去除 0 共享集群
|
this.clusterMode = (this.clusterModes && this.clusterModes.filter(ele => ele.code !== 0)) || []; // 去除 0 共享集群
|
||||||
}
|
}
|
||||||
|
|
||||||
@action.bound
|
@action.bound
|
||||||
@@ -158,7 +158,7 @@ class Cluster {
|
|||||||
|
|
||||||
@action.bound
|
@action.bound
|
||||||
public setClusterDetailRealTime(data: IClusterReal) {
|
public setClusterDetailRealTime(data: IClusterReal) {
|
||||||
this.clusterRealData = data;
|
this.clusterRealData = data;
|
||||||
this.setRealLoading(false);
|
this.setRealLoading(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,9 +192,9 @@ class Cluster {
|
|||||||
@action.bound
|
@action.bound
|
||||||
public setClusterDetailThrottles(data: IThrottles[]) {
|
public setClusterDetailThrottles(data: IThrottles[]) {
|
||||||
this.clustersThrottles = data ? data.map((item, index) => {
|
this.clustersThrottles = data ? data.map((item, index) => {
|
||||||
item.key = index;
|
item.key = index;
|
||||||
return item;
|
return item;
|
||||||
}) : [];
|
}) : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@action.bound
|
@action.bound
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export interface IStrategyFilter {
|
|||||||
tkey: string;
|
tkey: string;
|
||||||
topt: string;
|
topt: string;
|
||||||
tval: string[];
|
tval: string[];
|
||||||
|
clusterIdentification?: string;
|
||||||
}
|
}
|
||||||
export interface IRequestParams {
|
export interface IRequestParams {
|
||||||
appId: string;
|
appId: string;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export interface IBtn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IClusterData {
|
export interface IClusterData {
|
||||||
|
clusterIdentification: any;
|
||||||
clusterId: number;
|
clusterId: number;
|
||||||
mode: number;
|
mode: number;
|
||||||
clusterName: string;
|
clusterName: string;
|
||||||
@@ -598,10 +599,12 @@ export interface IClusterReal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IBasicInfo {
|
export interface IBasicInfo {
|
||||||
|
clusterIdentification: any;
|
||||||
bootstrapServers: string;
|
bootstrapServers: string;
|
||||||
clusterId: number;
|
clusterId: number;
|
||||||
mode: number;
|
mode: number;
|
||||||
clusterName: string;
|
clusterName: string;
|
||||||
|
clusterNameCn: string;
|
||||||
clusterVersion: string;
|
clusterVersion: string;
|
||||||
gmtCreate: number;
|
gmtCreate: number;
|
||||||
gmtModify: number;
|
gmtModify: number;
|
||||||
@@ -920,8 +923,9 @@ export interface INewLogical {
|
|||||||
mode: number;
|
mode: number;
|
||||||
name: string;
|
name: string;
|
||||||
logicalClusterName?: string;
|
logicalClusterName?: string;
|
||||||
logicalClusterEName?: string;
|
logicalClusterNameCn?: string;
|
||||||
regionIdList: number[];
|
regionIdList: number[];
|
||||||
|
logicalClusterIdentification?:string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IPartitionsLocation {
|
export interface IPartitionsLocation {
|
||||||
|
|||||||
@@ -5,13 +5,13 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.xiaojukeji.kafka</groupId>
|
<groupId>com.xiaojukeji.kafka</groupId>
|
||||||
<artifactId>kafka-manager-core</artifactId>
|
<artifactId>kafka-manager-core</artifactId>
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
<version>${kafka-manager.revision}</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>kafka-manager</artifactId>
|
<artifactId>kafka-manager</artifactId>
|
||||||
<groupId>com.xiaojukeji.kafka</groupId>
|
<groupId>com.xiaojukeji.kafka</groupId>
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
<version>${kafka-manager.revision}</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -69,6 +69,19 @@ public class LogicalClusterMetadataManager {
|
|||||||
return LOGICAL_CLUSTER_ID_BROKER_ID_MAP.getOrDefault(logicClusterId, new HashSet<>());
|
return LOGICAL_CLUSTER_ID_BROKER_ID_MAP.getOrDefault(logicClusterId, new HashSet<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getTopicLogicalClusterId(Long physicalClusterId, String topicName) {
|
||||||
|
if (!LOADED.get()) {
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Long> logicalClusterIdMap = TOPIC_LOGICAL_MAP.get(physicalClusterId);
|
||||||
|
if (ValidateUtils.isNull(logicalClusterIdMap)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return logicalClusterIdMap.get(topicName);
|
||||||
|
}
|
||||||
|
|
||||||
public LogicalClusterDO getTopicLogicalCluster(Long physicalClusterId, String topicName) {
|
public LogicalClusterDO getTopicLogicalCluster(Long physicalClusterId, String topicName) {
|
||||||
if (!LOADED.get()) {
|
if (!LOADED.get()) {
|
||||||
flush();
|
flush();
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ import com.xiaojukeji.kafka.manager.common.bizenum.KafkaBrokerRoleEnum;
|
|||||||
import com.xiaojukeji.kafka.manager.common.constant.Constant;
|
import com.xiaojukeji.kafka.manager.common.constant.Constant;
|
||||||
import com.xiaojukeji.kafka.manager.common.constant.KafkaConstant;
|
import com.xiaojukeji.kafka.manager.common.constant.KafkaConstant;
|
||||||
import com.xiaojukeji.kafka.manager.common.entity.KafkaVersion;
|
import com.xiaojukeji.kafka.manager.common.entity.KafkaVersion;
|
||||||
|
import com.xiaojukeji.kafka.manager.common.utils.JsonUtils;
|
||||||
import com.xiaojukeji.kafka.manager.common.utils.ListUtils;
|
import com.xiaojukeji.kafka.manager.common.utils.ListUtils;
|
||||||
import com.xiaojukeji.kafka.manager.common.entity.pojo.ClusterDO;
|
import com.xiaojukeji.kafka.manager.common.entity.pojo.ClusterDO;
|
||||||
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
|
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
|
||||||
|
import com.xiaojukeji.kafka.manager.common.utils.jmx.JmxConfig;
|
||||||
import com.xiaojukeji.kafka.manager.common.zookeeper.znode.brokers.BrokerMetadata;
|
import com.xiaojukeji.kafka.manager.common.zookeeper.znode.brokers.BrokerMetadata;
|
||||||
import com.xiaojukeji.kafka.manager.common.zookeeper.znode.ControllerData;
|
import com.xiaojukeji.kafka.manager.common.zookeeper.znode.ControllerData;
|
||||||
import com.xiaojukeji.kafka.manager.common.zookeeper.znode.brokers.TopicMetadata;
|
import com.xiaojukeji.kafka.manager.common.zookeeper.znode.brokers.TopicMetadata;
|
||||||
@@ -118,8 +120,15 @@ public class PhysicalClusterMetadataManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JmxConfig jmxConfig = null;
|
||||||
|
try {
|
||||||
|
jmxConfig = JsonUtils.stringToObj(clusterDO.getJmxProperties(), JmxConfig.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error("class=PhysicalClusterMetadataManager||method=addNew||clusterDO={}||msg=parse jmx properties failed", JsonUtils.toJSONString(clusterDO));
|
||||||
|
}
|
||||||
|
|
||||||
//增加Broker监控
|
//增加Broker监控
|
||||||
BrokerStateListener brokerListener = new BrokerStateListener(clusterDO.getId(), zkConfig, configUtils.getJmxMaxConn());
|
BrokerStateListener brokerListener = new BrokerStateListener(clusterDO.getId(), zkConfig, jmxConfig);
|
||||||
brokerListener.init();
|
brokerListener.init();
|
||||||
zkConfig.watchChildren(ZkPathUtil.BROKER_IDS_ROOT, brokerListener);
|
zkConfig.watchChildren(ZkPathUtil.BROKER_IDS_ROOT, brokerListener);
|
||||||
|
|
||||||
@@ -280,7 +289,7 @@ public class PhysicalClusterMetadataManager {
|
|||||||
|
|
||||||
//---------------------------Broker元信息相关--------------
|
//---------------------------Broker元信息相关--------------
|
||||||
|
|
||||||
public static void putBrokerMetadata(Long clusterId, Integer brokerId, BrokerMetadata brokerMetadata, Integer jmxMaxConn) {
|
public static void putBrokerMetadata(Long clusterId, Integer brokerId, BrokerMetadata brokerMetadata, JmxConfig jmxConfig) {
|
||||||
Map<Integer, BrokerMetadata> metadataMap = BROKER_METADATA_MAP.get(clusterId);
|
Map<Integer, BrokerMetadata> metadataMap = BROKER_METADATA_MAP.get(clusterId);
|
||||||
if (metadataMap == null) {
|
if (metadataMap == null) {
|
||||||
return;
|
return;
|
||||||
@@ -288,7 +297,7 @@ public class PhysicalClusterMetadataManager {
|
|||||||
metadataMap.put(brokerId, brokerMetadata);
|
metadataMap.put(brokerId, brokerMetadata);
|
||||||
|
|
||||||
Map<Integer, JmxConnectorWrap> jmxMap = JMX_CONNECTOR_MAP.getOrDefault(clusterId, new ConcurrentHashMap<>());
|
Map<Integer, JmxConnectorWrap> jmxMap = JMX_CONNECTOR_MAP.getOrDefault(clusterId, new ConcurrentHashMap<>());
|
||||||
jmxMap.put(brokerId, new JmxConnectorWrap(brokerMetadata.getHost(), brokerMetadata.getJmxPort(), jmxMaxConn));
|
jmxMap.put(brokerId, new JmxConnectorWrap(brokerMetadata.getHost(), brokerMetadata.getJmxPort(), jmxConfig));
|
||||||
JMX_CONNECTOR_MAP.put(clusterId, jmxMap);
|
JMX_CONNECTOR_MAP.put(clusterId, jmxMap);
|
||||||
|
|
||||||
Map<Integer, KafkaVersion> versionMap = KAFKA_VERSION_MAP.getOrDefault(clusterId, new ConcurrentHashMap<>());
|
Map<Integer, KafkaVersion> versionMap = KAFKA_VERSION_MAP.getOrDefault(clusterId, new ConcurrentHashMap<>());
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public interface ClusterService {
|
|||||||
|
|
||||||
ClusterNameDTO getClusterName(Long logicClusterId);
|
ClusterNameDTO getClusterName(Long logicClusterId);
|
||||||
|
|
||||||
ResultStatus deleteById(Long clusterId);
|
ResultStatus deleteById(Long clusterId, String operator);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取优先被选举为controller的broker
|
* 获取优先被选举为controller的broker
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.xiaojukeji.kafka.manager.service.service;
|
package com.xiaojukeji.kafka.manager.service.service;
|
||||||
|
|
||||||
|
import com.xiaojukeji.kafka.manager.common.bizenum.ModuleEnum;
|
||||||
|
import com.xiaojukeji.kafka.manager.common.bizenum.OperateEnum;
|
||||||
import com.xiaojukeji.kafka.manager.common.entity.dto.rd.OperateRecordDTO;
|
import com.xiaojukeji.kafka.manager.common.entity.dto.rd.OperateRecordDTO;
|
||||||
import com.xiaojukeji.kafka.manager.common.entity.pojo.OperateRecordDO;
|
import com.xiaojukeji.kafka.manager.common.entity.pojo.OperateRecordDO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhongyuankai
|
* @author zhongyuankai
|
||||||
@@ -12,5 +15,7 @@ import java.util.List;
|
|||||||
public interface OperateRecordService {
|
public interface OperateRecordService {
|
||||||
int insert(OperateRecordDO operateRecordDO);
|
int insert(OperateRecordDO operateRecordDO);
|
||||||
|
|
||||||
|
int insert(String operator, ModuleEnum module, String resourceName, OperateEnum operate, Map<String, String> content);
|
||||||
|
|
||||||
List<OperateRecordDO> queryByCondt(OperateRecordDTO dto);
|
List<OperateRecordDO> queryByCondt(OperateRecordDTO dto);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public interface AppService {
|
|||||||
* @param appDO appDO
|
* @param appDO appDO
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
ResultStatus addApp(AppDO appDO);
|
ResultStatus addApp(AppDO appDO, String operator);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除数据
|
* 删除数据
|
||||||
|
|||||||
@@ -60,10 +60,8 @@ public class AppServiceImpl implements AppService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private OperateRecordService operateRecordService;
|
private OperateRecordService operateRecordService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResultStatus addApp(AppDO appDO) {
|
public ResultStatus addApp(AppDO appDO, String operator) {
|
||||||
try {
|
try {
|
||||||
if (appDao.insert(appDO) < 1) {
|
if (appDao.insert(appDO) < 1) {
|
||||||
LOGGER.warn("class=AppServiceImpl||method=addApp||AppDO={}||msg=add fail,{}",appDO,ResultStatus.MYSQL_ERROR.getMessage());
|
LOGGER.warn("class=AppServiceImpl||method=addApp||AppDO={}||msg=add fail,{}",appDO,ResultStatus.MYSQL_ERROR.getMessage());
|
||||||
@@ -75,6 +73,15 @@ public class AppServiceImpl implements AppService {
|
|||||||
kafkaUserDO.setOperation(OperationStatusEnum.CREATE.getCode());
|
kafkaUserDO.setOperation(OperationStatusEnum.CREATE.getCode());
|
||||||
kafkaUserDO.setUserType(0);
|
kafkaUserDO.setUserType(0);
|
||||||
kafkaUserDao.insert(kafkaUserDO);
|
kafkaUserDao.insert(kafkaUserDO);
|
||||||
|
|
||||||
|
Map<String, String> content = new HashMap<>();
|
||||||
|
content.put("appId", appDO.getAppId());
|
||||||
|
content.put("name", appDO.getName());
|
||||||
|
content.put("applicant", appDO.getApplicant());
|
||||||
|
content.put("password", appDO.getPassword());
|
||||||
|
content.put("principals", appDO.getPrincipals());
|
||||||
|
content.put("description", appDO.getDescription());
|
||||||
|
operateRecordService.insert(operator, ModuleEnum.APP, appDO.getName(), OperateEnum.ADD, content);
|
||||||
} catch (DuplicateKeyException e) {
|
} catch (DuplicateKeyException e) {
|
||||||
LOGGER.error("class=AppServiceImpl||method=addApp||errMsg={}||appDO={}|", e.getMessage(), appDO, e);
|
LOGGER.error("class=AppServiceImpl||method=addApp||errMsg={}||appDO={}|", e.getMessage(), appDO, e);
|
||||||
return ResultStatus.RESOURCE_ALREADY_EXISTED;
|
return ResultStatus.RESOURCE_ALREADY_EXISTED;
|
||||||
@@ -141,6 +148,12 @@ public class AppServiceImpl implements AppService {
|
|||||||
appDO.setDescription(dto.getDescription());
|
appDO.setDescription(dto.getDescription());
|
||||||
|
|
||||||
if (appDao.updateById(appDO) > 0) {
|
if (appDao.updateById(appDO) > 0) {
|
||||||
|
Map<String, String> content = new HashMap<>();
|
||||||
|
content.put("appId", appDO.getAppId());
|
||||||
|
content.put("name", appDO.getName());
|
||||||
|
content.put("principals", appDO.getPrincipals());
|
||||||
|
content.put("description", appDO.getDescription());
|
||||||
|
operateRecordService.insert(operator, ModuleEnum.APP, appDO.getName(), OperateEnum.EDIT, content);
|
||||||
return ResultStatus.SUCCESS;
|
return ResultStatus.SUCCESS;
|
||||||
}
|
}
|
||||||
} catch (DuplicateKeyException e) {
|
} catch (DuplicateKeyException e) {
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package com.xiaojukeji.kafka.manager.service.service.impl;
|
package com.xiaojukeji.kafka.manager.service.service.impl;
|
||||||
|
|
||||||
import com.xiaojukeji.kafka.manager.common.bizenum.DBStatusEnum;
|
import com.xiaojukeji.kafka.manager.common.bizenum.DBStatusEnum;
|
||||||
import com.xiaojukeji.kafka.manager.common.constant.Constant;
|
import com.xiaojukeji.kafka.manager.common.bizenum.ModuleEnum;
|
||||||
|
import com.xiaojukeji.kafka.manager.common.bizenum.OperateEnum;
|
||||||
import com.xiaojukeji.kafka.manager.common.entity.Result;
|
import com.xiaojukeji.kafka.manager.common.entity.Result;
|
||||||
import com.xiaojukeji.kafka.manager.common.entity.ResultStatus;
|
import com.xiaojukeji.kafka.manager.common.entity.ResultStatus;
|
||||||
import com.xiaojukeji.kafka.manager.common.entity.ao.ClusterDetailDTO;
|
import com.xiaojukeji.kafka.manager.common.entity.ao.ClusterDetailDTO;
|
||||||
@@ -16,10 +17,7 @@ import com.xiaojukeji.kafka.manager.dao.ClusterMetricsDao;
|
|||||||
import com.xiaojukeji.kafka.manager.dao.ControllerDao;
|
import com.xiaojukeji.kafka.manager.dao.ControllerDao;
|
||||||
import com.xiaojukeji.kafka.manager.service.cache.LogicalClusterMetadataManager;
|
import com.xiaojukeji.kafka.manager.service.cache.LogicalClusterMetadataManager;
|
||||||
import com.xiaojukeji.kafka.manager.service.cache.PhysicalClusterMetadataManager;
|
import com.xiaojukeji.kafka.manager.service.cache.PhysicalClusterMetadataManager;
|
||||||
import com.xiaojukeji.kafka.manager.service.service.ClusterService;
|
import com.xiaojukeji.kafka.manager.service.service.*;
|
||||||
import com.xiaojukeji.kafka.manager.service.service.ConsumerService;
|
|
||||||
import com.xiaojukeji.kafka.manager.service.service.RegionService;
|
|
||||||
import com.xiaojukeji.kafka.manager.service.service.ZookeeperService;
|
|
||||||
import com.xiaojukeji.kafka.manager.service.utils.ConfigUtils;
|
import com.xiaojukeji.kafka.manager.service.utils.ConfigUtils;
|
||||||
import org.apache.zookeeper.ZooKeeper;
|
import org.apache.zookeeper.ZooKeeper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -66,15 +64,24 @@ public class ClusterServiceImpl implements ClusterService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ZookeeperService zookeeperService;
|
private ZookeeperService zookeeperService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OperateRecordService operateRecordService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResultStatus addNew(ClusterDO clusterDO, String operator) {
|
public ResultStatus addNew(ClusterDO clusterDO, String operator) {
|
||||||
if (ValidateUtils.isNull(clusterDO) || ValidateUtils.isNull(operator)) {
|
if (ValidateUtils.isNull(clusterDO) || ValidateUtils.isNull(operator)) {
|
||||||
return ResultStatus.PARAM_ILLEGAL;
|
return ResultStatus.PARAM_ILLEGAL;
|
||||||
}
|
}
|
||||||
if (!isZookeeperLegal(clusterDO.getZookeeper())) {
|
if (!isZookeeperLegal(clusterDO.getZookeeper())) {
|
||||||
return ResultStatus.CONNECT_ZOOKEEPER_FAILED;
|
return ResultStatus.ZOOKEEPER_CONNECT_FAILED;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
Map<String, String> content = new HashMap<>();
|
||||||
|
content.put("zk address", clusterDO.getZookeeper());
|
||||||
|
content.put("bootstrap servers", clusterDO.getBootstrapServers());
|
||||||
|
content.put("security properties", clusterDO.getSecurityProperties());
|
||||||
|
content.put("jmx properties", clusterDO.getJmxProperties());
|
||||||
|
operateRecordService.insert(operator, ModuleEnum.CLUSTER, clusterDO.getClusterName(), OperateEnum.ADD, content);
|
||||||
if (clusterDao.insert(clusterDO) <= 0) {
|
if (clusterDao.insert(clusterDO) <= 0) {
|
||||||
LOGGER.error("add new cluster failed, clusterDO:{}.", clusterDO);
|
LOGGER.error("add new cluster failed, clusterDO:{}.", clusterDO);
|
||||||
return ResultStatus.MYSQL_ERROR;
|
return ResultStatus.MYSQL_ERROR;
|
||||||
@@ -102,9 +109,14 @@ public class ClusterServiceImpl implements ClusterService {
|
|||||||
|
|
||||||
if (!originClusterDO.getZookeeper().equals(clusterDO.getZookeeper())) {
|
if (!originClusterDO.getZookeeper().equals(clusterDO.getZookeeper())) {
|
||||||
// 不允许修改zk地址
|
// 不允许修改zk地址
|
||||||
return ResultStatus.CHANGE_ZOOKEEPER_FORBIDEN;
|
return ResultStatus.CHANGE_ZOOKEEPER_FORBIDDEN;
|
||||||
}
|
}
|
||||||
clusterDO.setStatus(originClusterDO.getStatus());
|
clusterDO.setStatus(originClusterDO.getStatus());
|
||||||
|
Map<String, String> content = new HashMap<>();
|
||||||
|
content.put("cluster id", clusterDO.getId().toString());
|
||||||
|
content.put("security properties", clusterDO.getSecurityProperties());
|
||||||
|
content.put("jmx properties", clusterDO.getJmxProperties());
|
||||||
|
operateRecordService.insert(operator, ModuleEnum.CLUSTER, clusterDO.getClusterName(), OperateEnum.EDIT, content);
|
||||||
return updateById(clusterDO);
|
return updateById(clusterDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,6 +215,7 @@ public class ClusterServiceImpl implements ClusterService {
|
|||||||
zk.close();
|
zk.close();
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -254,12 +267,15 @@ public class ClusterServiceImpl implements ClusterService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResultStatus deleteById(Long clusterId) {
|
public ResultStatus deleteById(Long clusterId, String operator) {
|
||||||
List<RegionDO> regionDOList = regionService.getByClusterId(clusterId);
|
List<RegionDO> regionDOList = regionService.getByClusterId(clusterId);
|
||||||
if (!ValidateUtils.isEmptyList(regionDOList)) {
|
if (!ValidateUtils.isEmptyList(regionDOList)) {
|
||||||
return ResultStatus.OPERATION_FORBIDDEN;
|
return ResultStatus.OPERATION_FORBIDDEN;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
Map<String, String> content = new HashMap<>();
|
||||||
|
content.put("cluster id", clusterId.toString());
|
||||||
|
operateRecordService.insert(operator, ModuleEnum.CLUSTER, getClusterName(clusterId).getPhysicalClusterName(), OperateEnum.DELETE, content);
|
||||||
if (clusterDao.deleteById(clusterId) <= 0) {
|
if (clusterDao.deleteById(clusterId) <= 0) {
|
||||||
LOGGER.error("delete cluster failed, clusterId:{}.", clusterId);
|
LOGGER.error("delete cluster failed, clusterId:{}.", clusterId);
|
||||||
return ResultStatus.MYSQL_ERROR;
|
return ResultStatus.MYSQL_ERROR;
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ public class LogicalClusterServiceImpl implements LogicalClusterService {
|
|||||||
LogicalCluster logicalCluster = new LogicalCluster();
|
LogicalCluster logicalCluster = new LogicalCluster();
|
||||||
logicalCluster.setLogicalClusterId(logicalClusterDO.getId());
|
logicalCluster.setLogicalClusterId(logicalClusterDO.getId());
|
||||||
logicalCluster.setLogicalClusterName(logicalClusterDO.getName());
|
logicalCluster.setLogicalClusterName(logicalClusterDO.getName());
|
||||||
|
logicalCluster.setLogicalClusterIdentification(logicalClusterDO.getIdentification());
|
||||||
logicalCluster.setClusterVersion(
|
logicalCluster.setClusterVersion(
|
||||||
physicalClusterMetadataManager.getKafkaVersion(
|
physicalClusterMetadataManager.getKafkaVersion(
|
||||||
logicalClusterDO.getClusterId(),
|
logicalClusterDO.getClusterId(),
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.xiaojukeji.kafka.manager.service.service.impl;
|
package com.xiaojukeji.kafka.manager.service.service.impl;
|
||||||
|
|
||||||
|
import com.xiaojukeji.kafka.manager.common.bizenum.ModuleEnum;
|
||||||
|
import com.xiaojukeji.kafka.manager.common.bizenum.OperateEnum;
|
||||||
import com.xiaojukeji.kafka.manager.common.entity.dto.rd.OperateRecordDTO;
|
import com.xiaojukeji.kafka.manager.common.entity.dto.rd.OperateRecordDTO;
|
||||||
import com.xiaojukeji.kafka.manager.common.entity.pojo.OperateRecordDO;
|
import com.xiaojukeji.kafka.manager.common.entity.pojo.OperateRecordDO;
|
||||||
|
import com.xiaojukeji.kafka.manager.common.utils.JsonUtils;
|
||||||
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
|
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
|
||||||
import com.xiaojukeji.kafka.manager.dao.OperateRecordDao;
|
import com.xiaojukeji.kafka.manager.dao.OperateRecordDao;
|
||||||
import com.xiaojukeji.kafka.manager.service.service.OperateRecordService;
|
import com.xiaojukeji.kafka.manager.service.service.OperateRecordService;
|
||||||
@@ -10,6 +13,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhongyuankai
|
* @author zhongyuankai
|
||||||
@@ -25,6 +29,17 @@ public class OperateRecordServiceImpl implements OperateRecordService {
|
|||||||
return operateRecordDao.insert(operateRecordDO);
|
return operateRecordDao.insert(operateRecordDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insert(String operator, ModuleEnum module, String resourceName, OperateEnum operate, Map<String, String> content) {
|
||||||
|
OperateRecordDO operateRecordDO = new OperateRecordDO();
|
||||||
|
operateRecordDO.setOperator(operator);
|
||||||
|
operateRecordDO.setModuleId(module.getCode());
|
||||||
|
operateRecordDO.setResource(resourceName);
|
||||||
|
operateRecordDO.setOperateId(operate.getCode());
|
||||||
|
operateRecordDO.setContent(JsonUtils.toJSONString(content));
|
||||||
|
return insert(operateRecordDO);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OperateRecordDO> queryByCondt(OperateRecordDTO dto) {
|
public List<OperateRecordDO> queryByCondt(OperateRecordDTO dto) {
|
||||||
return operateRecordDao.queryByCondt(
|
return operateRecordDao.queryByCondt(
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.xiaojukeji.kafka.manager.service.service.impl;
|
package com.xiaojukeji.kafka.manager.service.service.impl;
|
||||||
|
|
||||||
import com.xiaojukeji.kafka.manager.common.bizenum.KafkaClientEnum;
|
import com.xiaojukeji.kafka.manager.common.bizenum.KafkaClientEnum;
|
||||||
|
import com.xiaojukeji.kafka.manager.common.bizenum.ModuleEnum;
|
||||||
|
import com.xiaojukeji.kafka.manager.common.bizenum.OperateEnum;
|
||||||
import com.xiaojukeji.kafka.manager.common.bizenum.TopicAuthorityEnum;
|
import com.xiaojukeji.kafka.manager.common.bizenum.TopicAuthorityEnum;
|
||||||
|
import com.xiaojukeji.kafka.manager.common.constant.KafkaConstant;
|
||||||
import com.xiaojukeji.kafka.manager.common.constant.KafkaMetricsCollections;
|
import com.xiaojukeji.kafka.manager.common.constant.KafkaMetricsCollections;
|
||||||
import com.xiaojukeji.kafka.manager.common.constant.TopicCreationConstant;
|
import com.xiaojukeji.kafka.manager.common.constant.TopicCreationConstant;
|
||||||
import com.xiaojukeji.kafka.manager.common.entity.Result;
|
import com.xiaojukeji.kafka.manager.common.entity.Result;
|
||||||
@@ -80,6 +83,9 @@ public class TopicManagerServiceImpl implements TopicManagerService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private RegionService regionService;
|
private RegionService regionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OperateRecordService operateRecordService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TopicDO> listAll() {
|
public List<TopicDO> listAll() {
|
||||||
try {
|
try {
|
||||||
@@ -293,6 +299,10 @@ public class TopicManagerServiceImpl implements TopicManagerService {
|
|||||||
Map<String, TopicDO> topicMap) {
|
Map<String, TopicDO> topicMap) {
|
||||||
List<TopicDTO> dtoList = new ArrayList<>();
|
List<TopicDTO> dtoList = new ArrayList<>();
|
||||||
for (String topicName: PhysicalClusterMetadataManager.getTopicNameList(clusterDO.getId())) {
|
for (String topicName: PhysicalClusterMetadataManager.getTopicNameList(clusterDO.getId())) {
|
||||||
|
if (topicName.equals(KafkaConstant.COORDINATOR_TOPIC_NAME) || topicName.equals(KafkaConstant.TRANSACTION_TOPIC_NAME)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
LogicalClusterDO logicalClusterDO = logicalClusterMetadataManager.getTopicLogicalCluster(
|
LogicalClusterDO logicalClusterDO = logicalClusterMetadataManager.getTopicLogicalCluster(
|
||||||
clusterDO.getId(),
|
clusterDO.getId(),
|
||||||
topicName
|
topicName
|
||||||
@@ -336,6 +346,12 @@ public class TopicManagerServiceImpl implements TopicManagerService {
|
|||||||
if (ValidateUtils.isNull(topicDO)) {
|
if (ValidateUtils.isNull(topicDO)) {
|
||||||
return ResultStatus.TOPIC_NOT_EXIST;
|
return ResultStatus.TOPIC_NOT_EXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, Object> content = new HashMap<>(2);
|
||||||
|
content.put("clusterId", clusterId);
|
||||||
|
content.put("topicName", topicName);
|
||||||
|
recordOperation(content, topicName, operator);
|
||||||
|
|
||||||
topicDO.setDescription(description);
|
topicDO.setDescription(description);
|
||||||
if (topicDao.updateByName(topicDO) > 0) {
|
if (topicDao.updateByName(topicDO) > 0) {
|
||||||
return ResultStatus.SUCCESS;
|
return ResultStatus.SUCCESS;
|
||||||
@@ -359,6 +375,12 @@ public class TopicManagerServiceImpl implements TopicManagerService {
|
|||||||
return ResultStatus.APP_NOT_EXIST;
|
return ResultStatus.APP_NOT_EXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, Object> content = new HashMap<>(4);
|
||||||
|
content.put("clusterId", clusterId);
|
||||||
|
content.put("topicName", topicName);
|
||||||
|
content.put("appId", appId);
|
||||||
|
recordOperation(content, topicName, operator);
|
||||||
|
|
||||||
TopicDO topicDO = topicDao.getByTopicName(clusterId, topicName);
|
TopicDO topicDO = topicDao.getByTopicName(clusterId, topicName);
|
||||||
if (ValidateUtils.isNull(topicDO)) {
|
if (ValidateUtils.isNull(topicDO)) {
|
||||||
// 不存在, 则需要插入
|
// 不存在, 则需要插入
|
||||||
@@ -389,6 +411,16 @@ public class TopicManagerServiceImpl implements TopicManagerService {
|
|||||||
return ResultStatus.MYSQL_ERROR;
|
return ResultStatus.MYSQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void recordOperation(Map<String, Object> content, String topicName, String operator) {
|
||||||
|
OperateRecordDO operateRecordDO = new OperateRecordDO();
|
||||||
|
operateRecordDO.setModuleId(ModuleEnum.TOPIC.getCode());
|
||||||
|
operateRecordDO.setOperateId(OperateEnum.EDIT.getCode());
|
||||||
|
operateRecordDO.setResource(topicName);
|
||||||
|
operateRecordDO.setContent(JsonUtils.toJSONString(content));
|
||||||
|
operateRecordDO.setOperator(operator);
|
||||||
|
operateRecordService.insert(operateRecordDO);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int deleteByTopicName(Long clusterId, String topicName) {
|
public int deleteByTopicName(Long clusterId, String topicName) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class ZookeeperServiceImpl implements ZookeeperService {
|
|||||||
}
|
}
|
||||||
ZkConfigImpl zkConfig = PhysicalClusterMetadataManager.getZKConfig(clusterId);
|
ZkConfigImpl zkConfig = PhysicalClusterMetadataManager.getZKConfig(clusterId);
|
||||||
if (ValidateUtils.isNull(zkConfig)) {
|
if (ValidateUtils.isNull(zkConfig)) {
|
||||||
return Result.buildFrom(ResultStatus.CONNECT_ZOOKEEPER_FAILED);
|
return Result.buildFrom(ResultStatus.ZOOKEEPER_CONNECT_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -68,6 +68,6 @@ public class ZookeeperServiceImpl implements ZookeeperService {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("class=ZookeeperServiceImpl||method=getControllerPreferredCandidates||clusterId={}||errMsg={}", clusterId, e.getMessage());
|
LOGGER.error("class=ZookeeperServiceImpl||method=getControllerPreferredCandidates||clusterId={}||errMsg={}", clusterId, e.getMessage());
|
||||||
}
|
}
|
||||||
return Result.buildFrom(ResultStatus.READ_ZOOKEEPER_FAILED);
|
return Result.buildFrom(ResultStatus.ZOOKEEPER_READ_FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,9 +13,6 @@ public class ConfigUtils {
|
|||||||
@Value(value = "${custom.idc}")
|
@Value(value = "${custom.idc}")
|
||||||
private String idc;
|
private String idc;
|
||||||
|
|
||||||
@Value("${custom.jmx.max-conn}")
|
|
||||||
private Integer jmxMaxConn;
|
|
||||||
|
|
||||||
@Value(value = "${spring.profiles.active}")
|
@Value(value = "${spring.profiles.active}")
|
||||||
private String kafkaManagerEnv;
|
private String kafkaManagerEnv;
|
||||||
|
|
||||||
@@ -30,14 +27,6 @@ public class ConfigUtils {
|
|||||||
this.idc = idc;
|
this.idc = idc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getJmxMaxConn() {
|
|
||||||
return jmxMaxConn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJmxMaxConn(Integer jmxMaxConn) {
|
|
||||||
this.jmxMaxConn = jmxMaxConn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKafkaManagerEnv() {
|
public String getKafkaManagerEnv() {
|
||||||
return kafkaManagerEnv;
|
return kafkaManagerEnv;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.xiaojukeji.kafka.manager.service.zookeeper;
|
package com.xiaojukeji.kafka.manager.service.zookeeper;
|
||||||
|
|
||||||
|
import com.xiaojukeji.kafka.manager.common.utils.jmx.JmxConfig;
|
||||||
import com.xiaojukeji.kafka.manager.common.zookeeper.znode.brokers.BrokerMetadata;
|
import com.xiaojukeji.kafka.manager.common.zookeeper.znode.brokers.BrokerMetadata;
|
||||||
import com.xiaojukeji.kafka.manager.common.zookeeper.StateChangeListener;
|
import com.xiaojukeji.kafka.manager.common.zookeeper.StateChangeListener;
|
||||||
import com.xiaojukeji.kafka.manager.common.zookeeper.ZkConfigImpl;
|
import com.xiaojukeji.kafka.manager.common.zookeeper.ZkConfigImpl;
|
||||||
@@ -22,12 +23,12 @@ public class BrokerStateListener implements StateChangeListener {
|
|||||||
|
|
||||||
private ZkConfigImpl zkConfig;
|
private ZkConfigImpl zkConfig;
|
||||||
|
|
||||||
private Integer jmxMaxConn;
|
private JmxConfig jmxConfig;
|
||||||
|
|
||||||
public BrokerStateListener(Long clusterId, ZkConfigImpl zkConfig, Integer jmxMaxConn) {
|
public BrokerStateListener(Long clusterId, ZkConfigImpl zkConfig, JmxConfig jmxConfig) {
|
||||||
this.clusterId = clusterId;
|
this.clusterId = clusterId;
|
||||||
this.zkConfig = zkConfig;
|
this.zkConfig = zkConfig;
|
||||||
this.jmxMaxConn = jmxMaxConn;
|
this.jmxConfig = jmxConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -84,7 +85,7 @@ public class BrokerStateListener implements StateChangeListener {
|
|||||||
}
|
}
|
||||||
brokerMetadata.setClusterId(clusterId);
|
brokerMetadata.setClusterId(clusterId);
|
||||||
brokerMetadata.setBrokerId(brokerId);
|
brokerMetadata.setBrokerId(brokerId);
|
||||||
PhysicalClusterMetadataManager.putBrokerMetadata(clusterId, brokerId, brokerMetadata, jmxMaxConn);
|
PhysicalClusterMetadataManager.putBrokerMetadata(clusterId, brokerId, brokerMetadata, jmxConfig);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("add broker failed, clusterId:{} brokerMetadata:{}.", clusterId, brokerMetadata, e);
|
LOGGER.error("add broker failed, clusterId:{} brokerMetadata:{}.", clusterId, brokerMetadata, e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,13 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>kafka-manager-dao</artifactId>
|
<artifactId>kafka-manager-dao</artifactId>
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
<version>${kafka-manager.revision}</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>kafka-manager</artifactId>
|
<artifactId>kafka-manager</artifactId>
|
||||||
<groupId>com.xiaojukeji.kafka</groupId>
|
<groupId>com.xiaojukeji.kafka</groupId>
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
<version>${kafka-manager.revision}</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
<result column="zookeeper" property="zookeeper" />
|
<result column="zookeeper" property="zookeeper" />
|
||||||
<result column="bootstrap_servers" property="bootstrapServers" />
|
<result column="bootstrap_servers" property="bootstrapServers" />
|
||||||
<result column="security_properties" property="securityProperties" />
|
<result column="security_properties" property="securityProperties" />
|
||||||
|
<result column="jmx_properties" property="jmxProperties" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<insert id="insert"
|
<insert id="insert"
|
||||||
@@ -19,9 +20,9 @@
|
|||||||
useGeneratedKeys="true"
|
useGeneratedKeys="true"
|
||||||
keyProperty="id">
|
keyProperty="id">
|
||||||
INSERT INTO cluster (
|
INSERT INTO cluster (
|
||||||
cluster_name, zookeeper, bootstrap_servers, security_properties
|
cluster_name, zookeeper, bootstrap_servers, security_properties, jmx_properties
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{clusterName}, #{zookeeper}, #{bootstrapServers}, #{securityProperties}
|
#{clusterName}, #{zookeeper}, #{bootstrapServers}, #{securityProperties}, #{jmxProperties}
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -30,6 +31,7 @@
|
|||||||
cluster_name=#{clusterName},
|
cluster_name=#{clusterName},
|
||||||
bootstrap_servers=#{bootstrapServers},
|
bootstrap_servers=#{bootstrapServers},
|
||||||
security_properties=#{securityProperties},
|
security_properties=#{securityProperties},
|
||||||
|
jmx_properties=#{jmxProperties},
|
||||||
status=#{status}
|
status=#{status}
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|||||||
@@ -1,24 +1,25 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="LogicalClusterDao">
|
<mapper namespace="LogicalClusterDao">
|
||||||
<resultMap id="LogicalClusterMap" type="com.xiaojukeji.kafka.manager.common.entity.pojo.LogicalClusterDO">
|
<resultMap id="LogicalClusterMap" type="com.xiaojukeji.kafka.manager.common.entity.pojo.LogicalClusterDO">
|
||||||
<id column="id" property="id" />
|
<id column="id" property="id" />
|
||||||
<result column="gmt_create" property="gmtCreate" />
|
<result column="gmt_create" property="gmtCreate" />
|
||||||
<result column="gmt_modify" property="gmtModify" />
|
<result column="gmt_modify" property="gmtModify" />
|
||||||
|
|
||||||
<result column="name" property="name" />
|
<result column="name" property="name" />
|
||||||
<result column="app_id" property="appId" />
|
<result column="identification" property="identification" />
|
||||||
<result column="cluster_id" property="clusterId" />
|
<result column="app_id" property="appId" />
|
||||||
<result column="region_list" property="regionList" />
|
<result column="cluster_id" property="clusterId" />
|
||||||
<result column="mode" property="mode" />
|
<result column="region_list" property="regionList" />
|
||||||
<result column="description" property="description" />
|
<result column="mode" property="mode" />
|
||||||
|
<result column="description" property="description" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<insert id="insert" parameterType="com.xiaojukeji.kafka.manager.common.entity.pojo.LogicalClusterDO">
|
<insert id="insert" parameterType="com.xiaojukeji.kafka.manager.common.entity.pojo.LogicalClusterDO">
|
||||||
INSERT INTO logical_cluster
|
INSERT INTO logical_cluster
|
||||||
(name, app_id, cluster_id, region_list, mode, description)
|
(name, identification, app_id, cluster_id, region_list, mode, description)
|
||||||
VALUES
|
VALUES
|
||||||
(#{name}, #{appId}, #{clusterId}, #{regionList}, #{mode}, #{description})
|
(#{name}, #{identification}, #{appId}, #{clusterId}, #{regionList}, #{mode}, #{description})
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<delete id="deleteById" parameterType="java.lang.Long">
|
<delete id="deleteById" parameterType="java.lang.Long">
|
||||||
@@ -27,7 +28,8 @@
|
|||||||
|
|
||||||
<update id="updateById" parameterType="com.xiaojukeji.kafka.manager.common.entity.pojo.LogicalClusterDO">
|
<update id="updateById" parameterType="com.xiaojukeji.kafka.manager.common.entity.pojo.LogicalClusterDO">
|
||||||
UPDATE logical_cluster SET
|
UPDATE logical_cluster SET
|
||||||
<!-- name=#{name}, 不允许修改 name, 会影响到上报的数据 -->
|
name=#{name},
|
||||||
|
<!-- identification=#{identification}, 不允许修改 identification, 会影响到上报的数据 -->
|
||||||
cluster_id=#{clusterId},
|
cluster_id=#{clusterId},
|
||||||
region_list=#{regionList},
|
region_list=#{regionList},
|
||||||
description=#{description},
|
description=#{description},
|
||||||
|
|||||||
@@ -4,13 +4,13 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>kafka-manager-account</artifactId>
|
<artifactId>kafka-manager-account</artifactId>
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
<version>${kafka-manager.revision}</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>kafka-manager</artifactId>
|
<artifactId>kafka-manager</artifactId>
|
||||||
<groupId>com.xiaojukeji.kafka</groupId>
|
<groupId>com.xiaojukeji.kafka</groupId>
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
<version>${kafka-manager.revision}</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.xiaojukeji.kafka.manager.account;
|
|||||||
|
|
||||||
import com.xiaojukeji.kafka.manager.account.common.EnterpriseStaff;
|
import com.xiaojukeji.kafka.manager.account.common.EnterpriseStaff;
|
||||||
import com.xiaojukeji.kafka.manager.common.bizenum.AccountRoleEnum;
|
import com.xiaojukeji.kafka.manager.common.bizenum.AccountRoleEnum;
|
||||||
|
import com.xiaojukeji.kafka.manager.common.entity.Result;
|
||||||
import com.xiaojukeji.kafka.manager.common.entity.ResultStatus;
|
import com.xiaojukeji.kafka.manager.common.entity.ResultStatus;
|
||||||
import com.xiaojukeji.kafka.manager.common.entity.ao.account.Account;
|
import com.xiaojukeji.kafka.manager.common.entity.ao.account.Account;
|
||||||
import com.xiaojukeji.kafka.manager.common.entity.pojo.AccountDO;
|
import com.xiaojukeji.kafka.manager.common.entity.pojo.AccountDO;
|
||||||
@@ -25,14 +26,14 @@ public interface AccountService {
|
|||||||
* @param username 用户名
|
* @param username 用户名
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AccountDO getAccountDO(String username);
|
Result<AccountDO> getAccountDO(String username);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除用户
|
* 删除用户
|
||||||
* @param username 用户名
|
* @param username 用户名
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResultStatus deleteByName(String username);
|
ResultStatus deleteByName(String username, String operator);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新账号
|
* 更新账号
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user