From e881c58a8ffc6035442fe65c5e0963b82533c945 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=AE=B8=E6=99=93=E4=B8=9C?= <763795151@qq.com>
Date: Sat, 27 Nov 2021 20:49:46 +0800
Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4topic=20=E9=99=90=E6=B5=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 2 +
.../service/impl/TopicServiceImpl.java | 1 +
.../scala/kafka/console/TopicConsole.scala | 10 +++++
ui/src/views/topic/ConfigTopicThrottle.vue | 39 +++++++++++--------
ui/src/views/topic/UpdateReplica.vue | 4 ++
5 files changed, 40 insertions(+), 16 deletions(-)
diff --git a/README.md b/README.md
index 6dfc65d..009136b 100644
--- a/README.md
+++ b/README.md
@@ -78,6 +78,8 @@ sh bin/shutdown.sh
## 注意
前后分离,直接启动后端如果未编译前端代码是没有前端页面的,可以先打包进行编译`sh package.sh`,然后再用idea启动,或者前端部分单独启动
# 页面示例
+如果未启用ACL配置,不会显示ACL的菜单页面,所以导航栏上没有Acl这一项
+



diff --git a/src/main/java/com/xuxd/kafka/console/service/impl/TopicServiceImpl.java b/src/main/java/com/xuxd/kafka/console/service/impl/TopicServiceImpl.java
index 5bdc960..0c3f0e4 100644
--- a/src/main/java/com/xuxd/kafka/console/service/impl/TopicServiceImpl.java
+++ b/src/main/java/com/xuxd/kafka/console/service/impl/TopicServiceImpl.java
@@ -157,6 +157,7 @@ public class TopicServiceImpl implements TopicService {
tuple2 = topicConsole.configThrottle(topic, partitions);
break;
case OFF:
+ tuple2 = topicConsole.clearThrottle(topic);
break;
default:
throw new IllegalArgumentException("switch is unknown.");
diff --git a/src/main/scala/kafka/console/TopicConsole.scala b/src/main/scala/kafka/console/TopicConsole.scala
index 946e496..61905e9 100644
--- a/src/main/scala/kafka/console/TopicConsole.scala
+++ b/src/main/scala/kafka/console/TopicConsole.scala
@@ -224,6 +224,16 @@ class TopicConsole(config: KafkaConfig) extends KafkaConsole(config: KafkaConfig
}).asInstanceOf[(Boolean, String)]
}
+ def clearThrottle(topic: String): (Boolean, String) = {
+ withAdminClientAndCatchError(admin => {
+ clearTopicLevelThrottles(admin, Collections.singleton(topic).asScala.toSet)
+ (true, "")
+ }, e => {
+ log.error("clearThrottle error, ", e)
+ (false, e.getMessage)
+ }).asInstanceOf[(Boolean, String)]
+ }
+
/**
* Get the current replica assignments for some topics.
*
diff --git a/ui/src/views/topic/ConfigTopicThrottle.vue b/ui/src/views/topic/ConfigTopicThrottle.vue
index d2f25bc..1deeb40 100644
--- a/ui/src/views/topic/ConfigTopicThrottle.vue
+++ b/ui/src/views/topic/ConfigTopicThrottle.vue
@@ -18,7 +18,23 @@
:label-col="{ span: 5 }"
:wrapper-col="{ span: 12 }"
>
-
说明:
@@ -93,6 +95,7 @@ export default {
loading: false,
form: this.$form.createForm(this, { name: "RemoveThrottleForm" }),
partitions: [],
+ showPartition: true,
};
},
watch: {
@@ -100,6 +103,7 @@ export default {
this.show = v;
if (this.show) {
this.getPartitionInfo();
+ this.showPartition = true;
}
},
},
@@ -128,7 +132,7 @@ export default {
ok() {
this.form.validateFields((err, values) => {
if (!err) {
- const data = Object.assign({}, values, {topic: this.topic});
+ const data = Object.assign({}, values, { topic: this.topic });
this.loading = true;
request({
url: KafkaTopicApi.configThrottle.url,
@@ -149,6 +153,9 @@ export default {
}
});
},
+ onChange(e) {
+ this.showPartition = !(e.target.value == "OFF");
+ },
},
};
diff --git a/ui/src/views/topic/UpdateReplica.vue b/ui/src/views/topic/UpdateReplica.vue
index d8b7299..3a3240f 100644
--- a/ui/src/views/topic/UpdateReplica.vue
+++ b/ui/src/views/topic/UpdateReplica.vue
@@ -57,6 +57,10 @@
运维->副本变更详情
处查看,也可以在那里将正在进行的任务取消。
+ *如果是减少副本,不用限流。如果是增加副本数,副本同步的时候如果有大量消息需要同步,可能占用大量带宽,担心会影响集群的稳定,考虑是否开启限流。同步完成可以再把该topic的限流关毕。关闭操作可以点击 + 限流按钮 处理。 +